Browse Source

Merge pull request #2376 from nocodb/fix/2361-case-insensitive-username

fix: make email case-insensitive
pull/2377/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
d9801a9166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      packages/nocodb/src/lib/models/User.ts

12
packages/nocodb/src/lib/models/User.ts

@ -47,6 +47,11 @@ export default class User implements UserType {
'roles',
'token_version'
]);
if (insertObj.email) {
insertObj.email = insertObj.email.toLowerCase();
}
const { id } = await ncMeta.metaInsert2(
null,
null,
@ -76,6 +81,10 @@ export default class User implements UserType {
'roles',
'token_version'
]);
if (updateObj.email) {
updateObj.email = updateObj.email.toLowerCase();
}
// get existing cache
const keys = [
// update user:<id>
@ -97,7 +106,8 @@ export default class User implements UserType {
// set meta
return await ncMeta.metaUpdate(null, null, MetaTable.USERS, updateObj, id);
}
public static async getByEmail(email, ncMeta = Noco.ncMeta) {
public static async getByEmail(_email: string, ncMeta = Noco.ncMeta) {
const email = _email?.toLowerCase();
let user =
email &&
(await NocoCache.get(

Loading…
Cancel
Save