mirror of
https://github.com/strapi/strapi.git
synced 2025-10-26 23:51:10 +00:00
Fix default role when login with custom providers
This commit is contained in:
parent
92a3c453b7
commit
ae51f39c62
@ -70,13 +70,13 @@ exports.connect = (provider, query) => {
|
||||
return resolve([null, [{ messages: [{ id: 'Auth.form.error.email.taken' }] }], 'Email is already taken.']);
|
||||
}
|
||||
|
||||
// Retrieve role `public`.
|
||||
const publicRole = await strapi.query('role', 'users-permissions').findOne({ type: 'public' }, []);
|
||||
// Retrieve role `authenticated`.
|
||||
const authenticatedRole = await strapi.query('role', 'users-permissions').findOne({ type: 'authenticated' }, []);
|
||||
|
||||
// Create the new user.
|
||||
const params = _.assign(profile, {
|
||||
provider: provider,
|
||||
role: publicRole._id || publicRole.id
|
||||
role: authenticatedRole._id || authenticatedRole.id
|
||||
});
|
||||
|
||||
const createdUser = await strapi.query('user', 'users-permissions').create(params);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user