π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(auth): handle signin bug caused by missing salt
Pranav C0029c2876fdf
diff --git a/packages/nocodb/src/modules/auth/auth.service.ts b/packages/nocodb/src/modules/auth/auth.service.tsindex 4935dde59c..cf64a2f9cb 100644--- a/packages/nocodb/src/modules/auth/auth.service.ts+++ b/packages/nocodb/src/modules/auth/auth.service.ts@@ -7,6 +7,7 @@ import { v4 as uuidv4 } from 'uuid';import Noco from '~/Noco';import { genJwt } from '~/services/users/helpers';import { UsersService } from '~/services/users/users.service';+import { NcError } from '~/helpers/ncError';export class CreateUserDto {readonly username: string;@@ -23,6 +24,16 @@ export class AuthService {if (user) {const { password, salt, ...result } = user;+ // `salt` will be null,+ // 1. If the user signup still in progeress+ // 2. If the user is invited and yet to set password+ // 3. If the user is created via non email-password auth (OAuth)+ if (!user.salt) {+ return NcError.badRequest(+ 'If signing up, wait to finish. If invited, use the email link. Otherwise, reset your password or contact the super admin.',+ );+ }+const hashedPassword = await promisify(bcrypt.hash)(pass, user.salt);if (user.password === hashedPassword) {return result;