mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 14:14:10 +00:00
Init auth errors
This commit is contained in:
parent
6da0cdcb6a
commit
642bee0085
@ -67,7 +67,8 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
|
||||
}
|
||||
|
||||
if (!this.isUrlProtected(props) && includes(props.location.pathname, 'register') && this.hasAdminUser(props)) {
|
||||
this.props.history.push('/plugins/users-permissions/auth/login');
|
||||
// TODO: uncomment
|
||||
// this.props.history.push('/plugins/users-permissions/auth/login');
|
||||
}
|
||||
|
||||
if (!props.hasUserPlugin || auth.getToken() && !this.state.hasAlreadyRegistereOtherPlugins) {
|
||||
|
||||
@ -40,6 +40,7 @@ export function* submitForm() {
|
||||
|
||||
yield put(submitSucceeded());
|
||||
} catch(error) {
|
||||
console.log(error.response.payload);
|
||||
const formType = yield select(makeSelectFormType());
|
||||
|
||||
const errors = error.response.payload.message.reduce((acc, key) => {
|
||||
|
||||
@ -26,9 +26,12 @@ module.exports = {
|
||||
if (_.get(this._attributes, [current, 'type'])) {
|
||||
acc[current] = params[current];
|
||||
}
|
||||
|
||||
|
||||
return acc;
|
||||
}, {}));
|
||||
}, {}))
|
||||
.catch((error) => {
|
||||
throw [{ messages: [{ id: error.message }]}];
|
||||
});
|
||||
},
|
||||
|
||||
update: async function (params) {
|
||||
|
||||
@ -414,23 +414,23 @@
|
||||
"controllers": {
|
||||
"auth": {
|
||||
"identity": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"policy": ""
|
||||
},
|
||||
"callback": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"policy": ""
|
||||
},
|
||||
"register": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"policy": ""
|
||||
},
|
||||
"forgotPassword": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"policy": ""
|
||||
},
|
||||
"changePassword": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"policy": ""
|
||||
}
|
||||
},
|
||||
@ -521,4 +521,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,12 +96,19 @@ module.exports = {
|
||||
|
||||
params.password = await strapi.plugins['users-permissions'].services.user.hashPassword(params);
|
||||
|
||||
const user = await strapi.query('user', 'users-permissions').create(params);
|
||||
try {
|
||||
const user = await strapi.query('user', 'users-permissions').create(params);
|
||||
|
||||
ctx.send({
|
||||
jwt: strapi.plugins['users-permissions'].services.jwt.issue(user),
|
||||
user: user
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
|
||||
ctx.badRequest(null, err)
|
||||
}
|
||||
|
||||
ctx.send({
|
||||
jwt: strapi.plugins['users-permissions'].services.jwt.issue(user),
|
||||
user: user
|
||||
});
|
||||
},
|
||||
|
||||
forgotPassword: async (ctx) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user