mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-02-02 00:39:35 +05:30
#218: do not write username into email field, because it may break logic of some features
This commit is contained in:
parent
8f51ef3273
commit
14f096a45f
@ -19,9 +19,18 @@ export function login({login = '', password = '', rememberMe = false}) {
|
|||||||
.catch((resp) => {
|
.catch((resp) => {
|
||||||
if (resp.errors) {
|
if (resp.errors) {
|
||||||
if (resp.errors.password === PASSWORD_REQUIRED) {
|
if (resp.errors.password === PASSWORD_REQUIRED) {
|
||||||
|
let username = '';
|
||||||
|
let email = '';
|
||||||
|
|
||||||
|
if (/[@.]/.test(login)) {
|
||||||
|
email = login;
|
||||||
|
} else {
|
||||||
|
username = login;
|
||||||
|
}
|
||||||
|
|
||||||
return dispatch(updateUser({
|
return dispatch(updateUser({
|
||||||
username: login,
|
username,
|
||||||
email: login
|
email
|
||||||
}));
|
}));
|
||||||
} else if (resp.errors.login === ACTIVATION_REQUIRED) {
|
} else if (resp.errors.login === ACTIVATION_REQUIRED) {
|
||||||
return dispatch(needActivation());
|
return dispatch(needActivation());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user