mirror of
https://github.com/strapi/strapi.git
synced 2025-12-24 13:43:41 +00:00
Fix /auth/login, user object ignore files and relations
Find user by email or identifier to get files and relations.
This commit is contained in:
parent
649df34583
commit
04f0995b43
@ -57,15 +57,17 @@ module.exports = {
|
||||
const isEmail = emailRegExp.test(params.identifier);
|
||||
|
||||
// Set the identifier to the appropriate query field.
|
||||
let key = "email";
|
||||
if (isEmail) {
|
||||
query.email = params.identifier.toLowerCase();
|
||||
} else {
|
||||
query.username = params.identifier;
|
||||
key = "username";
|
||||
}
|
||||
|
||||
// Check if the user exists.
|
||||
const user = await strapi.plugins['users-permissions'].queries('user', 'users-permissions')
|
||||
.findOne(query, ['role']);
|
||||
const user = await strapi.plugins["users-permissions"]
|
||||
.queries("user", "users-permissions")
|
||||
.findOne(_.pick(query, [key, key]));
|
||||
|
||||
if (!user) {
|
||||
return ctx.badRequest(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user