Skip to content

Commit

Permalink
Remove confirm from ValidatePasswordDto
Browse files Browse the repository at this point in the history
  • Loading branch information
flopez7 committed Jan 23, 2024
1 parent 260b73e commit 7688917
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ export const ResetPasswordForm = () => {
const navigate = useNavigate();
const token = new URLSearchParams(window.location.search).get('token');

const handleResetPassword = async ({ password, repeatPassword }) => {
const handleResetPassword = async ({ password }) => {
setIsLoading(true);
try {
await authService.resetPassword({
password,
confirm: repeatPassword,
token,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export const SignUpForm = ({ onFinish, onError }) => {
const [email, setEmail] = useState('');
const [alertMsg, setAlertMsg] = useState('');

const handleRegister = async ({ email, password, confirm }) => {
const handleRegister = async ({ email, password }) => {
setIsLoading(true);
try {
await authService.signUp({ email, password, confirm });
await authService.signUp({ email, password });
setEmail(email);
setIsSuccess(true);
} catch (err) {
Expand Down
2 changes: 0 additions & 2 deletions packages/apps/job-launcher/client/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export type SignInRequest = {
export type SignUpRequest = {
email: string;
password: string;
confirm: string;
};

export type SignUpResponse = {
Expand All @@ -18,7 +17,6 @@ export type SignUpResponse = {

export type ResetPasswordRequest = {
password: string;
confirm: string;
token: string;
};

Expand Down
67 changes: 0 additions & 67 deletions packages/apps/job-launcher/server/src/common/validators/confirm.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './password';
export * from './confirm';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsEmail, IsString } from 'class-validator';
import { IsConfirm, IsPassword } from '../../common/validators';
import { IsPassword } from '../../common/validators';
import { TokenType } from '../auth/token.entity';
import { UserEntity } from '../user/user.entity';

Expand All @@ -27,10 +27,6 @@ export class ValidatePasswordDto {
@ApiProperty()
@IsPassword()
public password: string;

@ApiProperty()
@IsConfirm()
public confirm: string;
}

export class ResendEmailVerificationDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ describe('AuthService', () => {
authService.restorePassword({
token: 'token',
password: 'password',
confirm: 'password',
}),
).rejects.toThrow(NotFoundException);
});
Expand All @@ -485,7 +484,6 @@ describe('AuthService', () => {
await authService.restorePassword({
token: 'token',
password: 'password',
confirm: 'password',
});

expect(updatePasswordMock).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ describe('UserService', () => {
const dto: UserCreateDto = {
email: '[email protected]',
password: 'password123',
confirm: 'password123',
};
const hashedPassword =
'$2b$12$Z02o9/Ay7CT0n99icApZYORH8iJI9VGtl3mju7d0c4SdDDujhSzOa';
Expand Down Expand Up @@ -102,7 +101,6 @@ describe('UserService', () => {
const dto: UserCreateDto = {
email: '[email protected]',
password: 'password123',
confirm: 'password123',
};

jest
Expand Down

0 comments on commit 7688917

Please sign in to comment.