mirror of
https://github.com/vale981/accounts-ui
synced 2025-03-06 02:11:41 -05:00
Fix "Username Required" error
When use USERNAME_AND_EMAIL auth fields it will show error if it open in Sign Up state then switch to Sign Up state and do login even if username or email field was filled.
This commit is contained in:
parent
f10425919f
commit
a6ac50d7d9
1 changed files with 15 additions and 17 deletions
|
@ -449,7 +449,20 @@ export class LoginForm extends Tracker.Component {
|
|||
|
||||
let loginSelector;
|
||||
|
||||
if (username !== null) {
|
||||
if (usernameOrEmail !== null) {
|
||||
// XXX not sure how we should validate this. but this seems good enough (for now),
|
||||
// since an email must have at least 3 characters anyways
|
||||
if (!this.validateUsername(usernameOrEmail)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (_.contains([ "USERNAME_AND_EMAIL_NO_PASSWORD" ], passwordSignupFields())) {
|
||||
this.loginWithoutPassword();
|
||||
return;
|
||||
}
|
||||
loginSelector = usernameOrEmail;
|
||||
}
|
||||
} else if (username !== null) {
|
||||
if (!this.validateUsername(username)) {
|
||||
return;
|
||||
}
|
||||
|
@ -468,22 +481,7 @@ export class LoginForm extends Tracker.Component {
|
|||
}
|
||||
loginSelector = { email };
|
||||
}
|
||||
}
|
||||
else if (usernameOrEmail !== null) {
|
||||
// XXX not sure how we should validate this. but this seems good enough (for now),
|
||||
// since an email must have at least 3 characters anyways
|
||||
if (!this.validateUsername(usernameOrEmail)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (_.contains([ "USERNAME_AND_EMAIL_NO_PASSWORD" ], passwordSignupFields())) {
|
||||
this.loginWithoutPassword();
|
||||
return;
|
||||
}
|
||||
loginSelector = usernameOrEmail;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new Error("Unexpected -- no element to use as a login user selector");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue