mirror of
https://github.com/vale981/accounts-ui
synced 2025-03-06 02:11:41 -05:00
Merge pull request #45 from ahmadsafar/master
Fix "Username Required" error
This commit is contained in:
commit
9975ba785b
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