mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-29 18:46:20 -05:00
Close login dropdown and clear errors on login
This commit is contained in:
parent
7b3874ffd5
commit
d96294e85b
1 changed files with 6 additions and 2 deletions
|
@ -34,6 +34,7 @@ module.exports = React.createClass({
|
||||||
this.setState({'loginOpen': false});
|
this.setState({'loginOpen': false});
|
||||||
},
|
},
|
||||||
handleLogIn: function (formData) {
|
handleLogIn: function (formData) {
|
||||||
|
this.setState({'loginError': null});
|
||||||
this.api({
|
this.api({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
uri: '/accounts/login/',
|
uri: '/accounts/login/',
|
||||||
|
@ -44,8 +45,10 @@ module.exports = React.createClass({
|
||||||
body = body[0];
|
body = body[0];
|
||||||
if (!body.success) {
|
if (!body.success) {
|
||||||
this.setState({'loginError': body.msg});
|
this.setState({'loginError': body.msg});
|
||||||
|
} else {
|
||||||
|
this.closeLogin();
|
||||||
|
window.refreshSession();
|
||||||
}
|
}
|
||||||
window.refreshSession();
|
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
@ -56,9 +59,10 @@ module.exports = React.createClass({
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
} else {
|
} else {
|
||||||
|
this.closeLogin();
|
||||||
window.refreshSession();
|
window.refreshSession();
|
||||||
}
|
}
|
||||||
});
|
}.bind(this));
|
||||||
},
|
},
|
||||||
handleClickAccountNav: function () {
|
handleClickAccountNav: function () {
|
||||||
this.setState({'accountNavOpen': true});
|
this.setState({'accountNavOpen': true});
|
||||||
|
|
Loading…
Reference in a new issue