mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
Fix provider auth
This commit is contained in:
parent
06ab6ba8cd
commit
9e5d0e991b
@ -26,7 +26,7 @@ module.exports = strapi => {
|
||||
|
||||
strapi.app.use(async (ctx, next) => {
|
||||
if (_.startsWith(ctx.request.url, '/connect') && ctx.request.method === 'GET') {
|
||||
const provider = _.last(ctx.request.url.split('/'));
|
||||
const provider = ctx.request.url.split('/')[2];
|
||||
const config = strapi.plugins['users-permissions'].config.grant[provider];
|
||||
|
||||
if (_.get(config, 'enabled')) {
|
||||
|
||||
@ -69,7 +69,7 @@ exports.connect = (provider, query) => {
|
||||
}
|
||||
|
||||
if (user && user.provider === provider) {
|
||||
return resolve([null, [{ messages: [{ id: 'Auth.form.error.email.taken' }] }], 'Email is already taken.']);
|
||||
return resolve([user, null]);
|
||||
}
|
||||
|
||||
if (user && user.provider !== provider && strapi.plugins['users-permissions'].config.advanced.unique_email) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user