diff --git a/frontend/src/app/components/auth/forgot-password/forgot-password.component.html b/frontend/src/app/components/auth/forgot-password/forgot-password.component.html index aa8e028..fc68bc3 100644 --- a/frontend/src/app/components/auth/forgot-password/forgot-password.component.html +++ b/frontend/src/app/components/auth/forgot-password/forgot-password.component.html @@ -66,21 +66,28 @@ (ngSubmit)="onSubmit(taskForm, password)" onsubmit="return false" > - +
+ + +
@if (!password.valid && password.touched && authData.password.length < 1) { @@ -90,22 +97,29 @@

Password is too short, min 6 characters

} }
- +
+ + +
@if (authData.password !== authData.passwordConfirm && passwordConfirm.touched) { diff --git a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts index 9b1f96e..1ebe656 100644 --- a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts +++ b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts @@ -28,7 +28,7 @@ export class ForgotPasswordComponent { constructor( private route: ActivatedRoute, - private authService: AuthService, + public authService: AuthService, public errorService: ErrorService ) {} diff --git a/frontend/src/app/components/auth/login/login.component.html b/frontend/src/app/components/auth/login/login.component.html index 503b9c7..cee4e16 100644 --- a/frontend/src/app/components/auth/login/login.component.html +++ b/frontend/src/app/components/auth/login/login.component.html @@ -31,21 +31,29 @@

This is not a valid email format

}}
- +
+ + +
@if (!password.valid && password.touched && authData.password.length < 1) { diff --git a/frontend/src/app/components/auth/login/login.component.ts b/frontend/src/app/components/auth/login/login.component.ts index 95e6a4b..7e37acf 100644 --- a/frontend/src/app/components/auth/login/login.component.ts +++ b/frontend/src/app/components/auth/login/login.component.ts @@ -22,8 +22,10 @@ export class LoginComponent { send: false, }; + showPassword: boolean = false; + constructor( - private authService: AuthService, + public authService: AuthService, public errorService: ErrorService, private router: Router ) {} diff --git a/frontend/src/app/components/auth/register/register.component.html b/frontend/src/app/components/auth/register/register.component.html index f07fc0c..e702618 100644 --- a/frontend/src/app/components/auth/register/register.component.html +++ b/frontend/src/app/components/auth/register/register.component.html @@ -40,21 +40,28 @@

This is not a valid email format

}}
- +
+ + +
@if (!password.valid && password.touched && authData.password.length < 1) { @@ -64,22 +71,29 @@

Password is too short, min 6 characters

} }
- +
+ + +
@if (authData.password !== authData.passwordConfirm && passwordConfirm.touched) { diff --git a/frontend/src/app/components/auth/register/register.component.ts b/frontend/src/app/components/auth/register/register.component.ts index f0c978d..0f79d13 100644 --- a/frontend/src/app/components/auth/register/register.component.ts +++ b/frontend/src/app/components/auth/register/register.component.ts @@ -26,7 +26,7 @@ export class RegisterComponent { constructor( private route: ActivatedRoute, - private authService: AuthService, + public authService: AuthService, public errorService: ErrorService, private router: Router ) {} diff --git a/frontend/src/app/services/auth.service.ts b/frontend/src/app/services/auth.service.ts index 1335272..c380386 100644 --- a/frontend/src/app/services/auth.service.ts +++ b/frontend/src/app/services/auth.service.ts @@ -8,9 +8,24 @@ import { environment } from '../environments/environment.development'; }) export class AuthService { errorMsg: string | null = null; + passwordFieldType: string = 'password'; + passwordIcon: string = './../../../assets/img/close-eye.svg'; constructor(private http: HttpClient) {} + togglePasswordVisibility() { + this.passwordFieldType = + this.passwordFieldType === 'password' ? 'text' : 'password'; + this.toggleIcon(); + } + + toggleIcon() { + this.passwordIcon = + this.passwordIcon === './../../../assets/img/close-eye.svg' + ? './../../../assets/img/open-eye.svg' + : './../../../assets/img/close-eye.svg'; + } + async register(body: any) { await lastValueFrom( this.http.post(`${environment.baseUrl}/auth/register/`, body) diff --git a/frontend/src/assets/img/close-eye.svg b/frontend/src/assets/img/close-eye.svg new file mode 100644 index 0000000..d4a6ec4 --- /dev/null +++ b/frontend/src/assets/img/close-eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/assets/img/open-eye.svg b/frontend/src/assets/img/open-eye.svg new file mode 100644 index 0000000..d136657 --- /dev/null +++ b/frontend/src/assets/img/open-eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/assets/style/form.scss b/frontend/src/assets/style/form.scss index 07f6591..89111b8 100644 --- a/frontend/src/assets/style/form.scss +++ b/frontend/src/assets/style/form.scss @@ -45,6 +45,23 @@ form { } } +// Show / Hide Password + +.password-field { + position: relative; + width: 100%; +} + +.passwordEye { + position: absolute; + right: 48px; + top: 50%; + transform: translateY(-50%); + cursor: pointer; + filter: brightness(0) saturate(100%) invert(16%) sepia(77%) saturate(7494%) + hue-rotate(241deg) brightness(93%) contrast(88%); +} + /*------------- RESPONSIVE -------------*/ @media screen and (max-width: 600px) { @@ -53,4 +70,8 @@ form { width: 100%; } } + + .passwordEye { + right: 18px; + } }