mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(core): Use lower cased email for SAML email attribute (#6663)
lower case saml email attribute
This commit is contained in:
parent
0c47be254b
commit
eedde24cc0
|
@ -145,8 +145,9 @@ export class SamlService {
|
|||
}> {
|
||||
const attributes = await this.getAttributesFromLoginResponse(req, binding);
|
||||
if (attributes.email) {
|
||||
const lowerCasedEmail = attributes.email.toLowerCase();
|
||||
const user = await Db.collections.User.findOne({
|
||||
where: { email: attributes.email },
|
||||
where: { email: lowerCasedEmail },
|
||||
relations: ['globalRole', 'authIdentities'],
|
||||
});
|
||||
if (user) {
|
||||
|
|
|
@ -97,7 +97,8 @@ export function generatePassword(): string {
|
|||
export async function createUserFromSamlAttributes(attributes: SamlUserAttributes): Promise<User> {
|
||||
const user = new User();
|
||||
const authIdentity = new AuthIdentity();
|
||||
user.email = attributes.email;
|
||||
const lowerCasedEmail = attributes.email?.toLowerCase() ?? '';
|
||||
user.email = lowerCasedEmail;
|
||||
user.firstName = attributes.firstName;
|
||||
user.lastName = attributes.lastName;
|
||||
user.globalRole = await Container.get(RoleRepository).findGlobalMemberRoleOrFail();
|
||||
|
|
Loading…
Reference in a new issue