Browse Source

fix: make email case-insensitive

re #2361

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2376/head
Pranav C 2 years ago
parent
commit
04345cc085
  1. 8
      packages/nocodb/src/lib/models/User.ts

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

@ -47,6 +47,9 @@ export default class User implements UserType {
'roles',
'token_version'
]);
insertObj.email = insertObj.email?.toLowerCase();
const { id } = await ncMeta.metaInsert2(
null,
null,
@ -76,6 +79,8 @@ export default class User implements UserType {
'roles',
'token_version'
]);
updateObj.email = updateObj.email?.toLowerCase();
// get existing cache
const keys = [
// update user:<id>
@ -97,7 +102,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