Browse Source

refactor: move the logic to findOne

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5868/head
Pranav C 1 year ago
parent
commit
3990facff0
  1. 4
      packages/nocodb/src/services/auth.service.ts
  2. 3
      packages/nocodb/src/services/users/users.service.ts

4
packages/nocodb/src/services/auth.service.ts

@ -13,9 +13,7 @@ import type { CreateUserDto } from '../controllers/auth.controller';
export class AuthService { export class AuthService {
constructor(private usersService: UsersService) {} constructor(private usersService: UsersService) {}
async validateUser(_email: string, pass: string): Promise<any> { async validateUser(email: string, pass: string): Promise<any> {
const email = _email.toLowerCase();
const user = await this.usersService.findOne(email); const user = await this.usersService.findOne(email);
if (user) { if (user) {
const { password, salt, ...result } = user; const { password, salt, ...result } = user;

3
packages/nocodb/src/services/users/users.service.ts

@ -32,7 +32,8 @@ import type {
export class UsersService { export class UsersService {
constructor(private metaService: MetaService) {} constructor(private metaService: MetaService) {}
async findOne(email: string) { async findOne(_email: string) {
const email = _email.toLowerCase();
const user = await this.metaService.metaGet(null, null, MetaTable.USERS, { const user = await this.metaService.metaGet(null, null, MetaTable.USERS, {
email, email,
}); });

Loading…
Cancel
Save