Allow unverified users to log in
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
هذا الالتزام موجود في:
@@ -63,7 +63,7 @@ export class AuthService {
|
|||||||
password: passwordHash,
|
password: passwordHash,
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
message: 'Registration successful. Account is pending SuperAdmin verification.',
|
message: 'Registration successful.',
|
||||||
email: user.email,
|
email: user.email,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ export class AuthService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
message: 'Registration successful. Account is pending SuperAdmin verification.',
|
message: 'Registration successful.',
|
||||||
email: user.email,
|
email: user.email,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -98,9 +98,6 @@ export class AuthService {
|
|||||||
if (user.isDisabled) {
|
if (user.isDisabled) {
|
||||||
throw new ForbiddenException('Account is disabled');
|
throw new ForbiddenException('Account is disabled');
|
||||||
}
|
}
|
||||||
if (!user.isVerified) {
|
|
||||||
throw new ForbiddenException('Account is pending SuperAdmin verification');
|
|
||||||
}
|
|
||||||
|
|
||||||
const isMatch = await compareHash(dto.password, user.password);
|
const isMatch = await compareHash(dto.password, user.password);
|
||||||
if (!isMatch) {
|
if (!isMatch) {
|
||||||
@@ -117,7 +114,7 @@ export class AuthService {
|
|||||||
): Promise<{ message: string; debugCode?: string }> {
|
): Promise<{ message: string; debugCode?: string }> {
|
||||||
const normalizedEmail = dto.email.toLowerCase();
|
const normalizedEmail = dto.email.toLowerCase();
|
||||||
const user = await this.usersService.findByEmail(normalizedEmail);
|
const user = await this.usersService.findByEmail(normalizedEmail);
|
||||||
const message = 'Account verification is managed by SuperAdmin';
|
const message = 'Account verification is optional and can be requested later';
|
||||||
if (!user || user.isDisabled) {
|
if (!user || user.isDisabled) {
|
||||||
return { message };
|
return { message };
|
||||||
}
|
}
|
||||||
@@ -125,12 +122,12 @@ export class AuthService {
|
|||||||
return { message: 'Account is already verified' };
|
return { message: 'Account is already verified' };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { message: 'Account is pending SuperAdmin verification' };
|
return { message: 'Account is not verified yet. Verification can be requested later.' };
|
||||||
}
|
}
|
||||||
|
|
||||||
async verifyEmail(_dto: VerifyEmailDto): Promise<{ message: string }> {
|
async verifyEmail(_dto: VerifyEmailDto): Promise<{ message: string }> {
|
||||||
return {
|
return {
|
||||||
message: 'Account verification is managed by SuperAdmin',
|
message: 'Account verification is optional and can be requested later',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,10 +221,6 @@ export class AuthService {
|
|||||||
throw new ForbiddenException('Account is disabled');
|
throw new ForbiddenException('Account is disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user.isVerified) {
|
|
||||||
throw new ForbiddenException('Account is pending SuperAdmin verification');
|
|
||||||
}
|
|
||||||
|
|
||||||
const tokens = await this.generateAndStoreTokenPair(user.id, user.username, user.role ?? 'user');
|
const tokens = await this.generateAndStoreTokenPair(user.id, user.username, user.role ?? 'user');
|
||||||
const safeUser = await this.usersService.findByIdOrFail(user.id);
|
const safeUser = await this.usersService.findByIdOrFail(user.id);
|
||||||
return { ...tokens, user: safeUser.toObject() as unknown as Record<string, unknown> };
|
return { ...tokens, user: safeUser.toObject() as unknown as Record<string, unknown> };
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم