Skip to content

Commit

Permalink
Update user registration to handle optional email
Browse files Browse the repository at this point in the history
  • Loading branch information
lukfor committed Dec 9, 2023
1 parent 59036a0 commit ed8938f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/html/webapp/components/core/user/signup/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import template from './signup.stache';
export default Control.extend({

"init": function(element, options) {
this.emailRequired = options.appState.attr('emailRequired');
$(element).hide();
$(element).html(template());
$(element).html(template({
emailRequired: options.appState.attr('emailRequired')
}));
$(element).fadeIn();
},

Expand All @@ -32,8 +35,10 @@ export default Control.extend({

// mail
var mail = $(element).find("[name='mail']");
var mailError = user.checkMail(mail.val());
this.updateControl(mail, mailError);
if (this.emailRequired || (mail.val() != "")){
var mailError = user.checkMail(mail.val());
this.updateControl(mail, mailError);
}

// password
var newPassword = $(element).find("[name='new-password']");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<div class="invalid-feedback"></div>
</div>

<p>Email Required: {{emailRequired}} </p>

<div class="form-group">
<label for="mail" class="control-label">E-Mail:</label>
Expand Down

0 comments on commit ed8938f

Please sign in to comment.