fix: the email vaerification logic error
This commit is contained in:
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+6
-2
@@ -73,8 +73,7 @@ export const enum UserMessage {
|
||||
PROFILE_PIC_REQUIRED = "عکس پروفایل نمیتواند خالی باشد",
|
||||
VERIFY_EMAIL_LINK_SENT = "لینک تایید ایمیل به ایمیل شما ارسال شد",
|
||||
EMAIL_VERIFIED = "ایمیل شما تایید شد",
|
||||
INVALID_EMAIL_TOKEN = "توکن ایمیل نامعتبر است",
|
||||
EXPIRED_EMAIL_TOKEN = "توکن ایمیل منقضی شده است",
|
||||
INVALID_EMAIL_TOKEN = "توکن ایمیل نامعتبر است یا منقضی شده است",
|
||||
PHONE_EXIST = "شماره تلفن قبلا ثبت شده است",
|
||||
ADDRESS_REQUIRED = "آدرس نمیتواند خالی باشد",
|
||||
ADDRESS_SHOULD_BE_STRING = "آدرس باید یک رشته باشد",
|
||||
@@ -340,6 +339,11 @@ export const enum SubscriptionMessage {
|
||||
SUBS_REQUIRED = "اشتراک مورد نیاز است",
|
||||
SUBS_SHOULD_BE_ARRAY = "اشتراک باید یک آرایه باشد",
|
||||
USER_SUBS_NOT_FOUND = "اشتراک کاربر یافت نشد",
|
||||
BUSINESS_NAME_REQUIRED = "BUSINESS_NAME_REQUIRED",
|
||||
BUSINESS_NAME_LENGTH = "BUSINESS_NAME_LENGTH",
|
||||
BUSINESS_PHONE_INVALID = "BUSINESS_PHONE_INVALID",
|
||||
DESCRIPTION_LENGTH = "DESCRIPTION_LENGTH",
|
||||
BUSINESS_NAME_STRING = "BUSINESS_NAME_STRING",
|
||||
}
|
||||
|
||||
export const enum InvoiceMessage {
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -3,7 +3,7 @@ import { IsNotEmpty, IsString, MinLength } from "class-validator";
|
||||
|
||||
import { AuthMessage } from "../../../common/enums/message.enum";
|
||||
|
||||
export class UpdatePasswordDto {
|
||||
export class ChangePasswordDto {
|
||||
@IsNotEmpty({ message: AuthMessage.PASSWORD_NOT_EMPTY })
|
||||
@IsString({ message: AuthMessage.PASSWORD_FORMAT_INVALID })
|
||||
@ApiProperty({ description: "old password", example: "12S345SS678" })
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+3
-4
@@ -2,16 +2,15 @@ import { Body, Controller, HttpCode, HttpStatus, Patch, Post, UseGuards } from "
|
||||
import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
||||
import { Throttle, ThrottlerGuard } from "@nestjs/throttler";
|
||||
|
||||
import { ChangePasswordDto } from "./DTO/change-password.dto";
|
||||
import { CompleteRegistrationDto } from "./DTO/complete-register.dto";
|
||||
import { CheckUserExistDto, LoginPasswordDTO } from "./DTO/loginPassword.dto";
|
||||
import { RequestOtpDto } from "./DTO/request-otp.dto";
|
||||
import { UpdatePasswordDto } from "./DTO/update-password.dto";
|
||||
import { VerifyOtpDto } from "./DTO/verify-otp.dto";
|
||||
import { AuthService } from "./providers/auth.service";
|
||||
import { AUTH_THROTTLE_LIMIT, AUTH_THROTTLE_TTL } from "../../common/constants";
|
||||
import { AuthGuards } from "../../common/decorators/auth-guard.decorator";
|
||||
import { UserDec } from "../../common/decorators/user.decorator";
|
||||
import { User } from "../users/entities/user.entity";
|
||||
|
||||
@ApiTags("Auth")
|
||||
@Controller("auth")
|
||||
@@ -80,8 +79,8 @@ export class AuthController {
|
||||
@ApiOperation({ summary: "Update user password" })
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Patch("change-password")
|
||||
updatePassword(@UserDec() user: User, @Body() updatePasswordDto: UpdatePasswordDto) {
|
||||
return this.authService.updatePassword(user.id, updatePasswordDto);
|
||||
changePassword(@UserDec("id") userId: string, @Body() changePasswordDto: ChangePasswordDto) {
|
||||
return this.authService.changePassword(userId, changePasswordDto);
|
||||
}
|
||||
//***************************** */
|
||||
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+2
-2
@@ -10,10 +10,10 @@ import { UsersService } from "../../users/providers/users.service";
|
||||
import { OTPService } from "../../utils/providers/otp.service";
|
||||
import { PasswordService } from "../../utils/providers/password.service";
|
||||
import { SmsService } from "../../utils/providers/sms.service";
|
||||
import { ChangePasswordDto } from "../DTO/change-password.dto";
|
||||
import { CompleteRegistrationDto } from "../DTO/complete-register.dto";
|
||||
import { CheckUserExistDto, LoginPasswordDTO } from "../DTO/loginPassword.dto";
|
||||
import { RequestOtpDto } from "../DTO/request-otp.dto";
|
||||
import { UpdatePasswordDto } from "../DTO/update-password.dto";
|
||||
import { VerifyOtpDto } from "../DTO/verify-otp.dto";
|
||||
|
||||
@Injectable()
|
||||
@@ -204,7 +204,7 @@ export class AuthService {
|
||||
}
|
||||
//****************** */
|
||||
|
||||
async updatePassword(userId: string, updateDto: UpdatePasswordDto) {
|
||||
async changePassword(userId: string, updateDto: ChangePasswordDto) {
|
||||
const { user } = await this.usersService.findOneById(userId);
|
||||
|
||||
const passCompare = await this.passwordService.comparePassword(updateDto.password, user.password);
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user