mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
code review : syntax
This commit is contained in:
parent
d07edb0c5b
commit
0674002553
@ -60,10 +60,14 @@ export class AuthPage extends React.Component { // eslint-disable-line react/pre
|
||||
this.setForm();
|
||||
hideLoginErrorsInput(false);
|
||||
}
|
||||
if (submitSuccess && submitSuccess !== prevProps.submitSuccess) {
|
||||
|
||||
if (submitSuccess) {
|
||||
switch (authType) {
|
||||
case 'login':
|
||||
case 'reset-password':
|
||||
// Check if we have token to handle redirection to login or admin.
|
||||
// Done to prevent redirection to admin after reset password if user should
|
||||
// not have access.
|
||||
auth.getToken()
|
||||
? this.redirect('/')
|
||||
: this.redirect('/plugins/users-permissions/auth/login');
|
||||
@ -135,7 +139,7 @@ export class AuthPage extends React.Component { // eslint-disable-line react/pre
|
||||
}
|
||||
}
|
||||
|
||||
redirect = path => this.props.history.push(path)
|
||||
redirect = path => this.props.history.push(path);
|
||||
|
||||
renderButton = () => {
|
||||
const { match: { params: { authType } }, submitSuccess } = this.props;
|
||||
|
||||
@ -37,6 +37,7 @@ export function* submitForm(action) {
|
||||
const response = yield call(request, requestURL, { method: 'POST', body: omit(body, 'news') });
|
||||
|
||||
if(get(response, 'user.role.name', '') === 'Administrator' || isRegister){
|
||||
|
||||
yield call(auth.setToken, response.jwt, body.rememberMe);
|
||||
yield call(auth.setUserInfo, response.user, body.rememberMe);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user