diff options
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/components/login/login.component.html | 7 | ||||
| -rw-r--r-- | src/app/components/login/login.component.ts | 5 | ||||
| -rw-r--r-- | src/app/components/register/register.component.html | 8 | ||||
| -rw-r--r-- | src/app/components/register/register.component.ts | 6 |
4 files changed, 21 insertions, 5 deletions
diff --git a/src/app/components/login/login.component.html b/src/app/components/login/login.component.html index 29aebf9..13ae97a 100644 --- a/src/app/components/login/login.component.html +++ b/src/app/components/login/login.component.html @@ -1,4 +1,4 @@ -<main class="centered-content flex-col flex-center-align-items flex-justify-center height-full"> +<main class="centered-content scroll-standalone flex-col flex-center-align-items flex-justify-center height-full"> <summary class="title card width-full margin-0 padding-dot2">Login</summary> <app-error-bar class="width-full margin-top-dot4"></app-error-bar> @@ -12,8 +12,11 @@ </div> </section> <section class="input-selection"> - <input type="password" placeholder="Password" class="fancy-input width-full border-faded-slim border-bottom-only" formControlName="password" required> + <input [type]="showingPassword ? 'text' : 'password'" placeholder="Password" class="fancy-input width-full border-faded-slim border-bottom-only" formControlName="password" required> <label class="fancy-input-label width-full">Password</label> + <button type="button" class="show-password-button hover-half-opacity click-effect" (click)="toggleShowPassword()"> + <img [src]="showingPassword ? '/assets/icons/tabler-icon-eye-off.svg' : '/assets/icons/tabler-icon-eye.svg'"> + </button> <div class="input-errors"> <label *ngIf="loginUserFormGroup.get('password')?.errors?.required" class="error">*Required</label> </div> diff --git a/src/app/components/login/login.component.ts b/src/app/components/login/login.component.ts index edbc461..a0ce730 100644 --- a/src/app/components/login/login.component.ts +++ b/src/app/components/login/login.component.ts @@ -16,6 +16,7 @@ export class LoginComponent implements OnInit { @ViewChild(ErrorBarComponent) private _errorBar: ErrorBarComponent; private _title = 'Login'; public loginUserFormGroup: FormGroup; + public showingPassword = false; constructor(private _titleService: Title, private _fb: FormBuilder, private _router: Router, private _userService: UserService, private _tokenService: TokenService) { this._titleService.setTitle(this._title); @@ -32,6 +33,10 @@ export class LoginComponent implements OnInit { }); } + toggleShowPassword(): void { + this.showingPassword = !this.showingPassword; + } + onSubmit(): void { this._errorBar.hideError(); this._userService.loginUserRequest(this.loginUserFormGroup).subscribe({ diff --git a/src/app/components/register/register.component.html b/src/app/components/register/register.component.html index 1f547c4..1cd6cdb 100644 --- a/src/app/components/register/register.component.html +++ b/src/app/components/register/register.component.html @@ -1,4 +1,4 @@ -<main class="centered-content flex-col flex-center-align-items flex-justify-center height-full"> +<main class="centered-content scroll-standalone height-full flex-col flex-center-align-items flex-justify-center"> <summary class="title card width-full margin-0 padding-dot2">Register</summary> <app-error-bar class="width-full margin-top-dot4"></app-error-bar> @@ -37,8 +37,11 @@ </div> </section> <section class="input-selection"> - <input type="password" placeholder="Password" class="fancy-input width-full border-faded-slim border-bottom-only" formControlName="password" required> + <input [type]="showingPassword ? 'text' : 'password'" placeholder="Password" class="fancy-input width-full border-faded-slim border-bottom-only" formControlName="password" required> <label class="fancy-input-label width-full">Password</label> + <button type="button" class="show-password-button hover-half-opacity click-effect" (click)="toggleShowPassword()"> + <img [src]="showingPassword ? '/assets/icons/tabler-icon-eye-off.svg' : '/assets/icons/tabler-icon-eye.svg'"> + </button> <div class="input-errors"> <label *ngIf="registerUserFormGroup.get('password')?.errors?.required" class="error">*Required</label> <label *ngIf="registerUserFormGroup.get('password')?.errors?.minlength" class="error">*Minimum 3 characters</label> @@ -46,7 +49,6 @@ </div> </section> - <button class="border-faded-slim padding-dot3 lighter-hover click-effect border-radius-dot3 width-full" type="submit">Submit</button> </form> <button class="fg-focus border-faded-slim padding-dot3 lighter-hover click-effect border-radius-dot3 width-full margin-top-dot4" (click)="onRedirectLogin()"> diff --git a/src/app/components/register/register.component.ts b/src/app/components/register/register.component.ts index 07b8976..6d84e11 100644 --- a/src/app/components/register/register.component.ts +++ b/src/app/components/register/register.component.ts @@ -16,6 +16,7 @@ export class RegisterComponent implements OnInit { @ViewChild(ErrorBarComponent) private _errorBar: ErrorBarComponent; private _title = 'Register'; public registerUserFormGroup: FormGroup; + public showingPassword = false; constructor(private _titleService: Title, private _fb: FormBuilder, private _router: Router, private _userService: UserService, private _tokenService: TokenService) { this._titleService.setTitle(this._title); @@ -49,6 +50,10 @@ export class RegisterComponent implements OnInit { // this.registerUserFormGroup.valueChanges.subscribe(console.log); } + toggleShowPassword(): void { + this.showingPassword = !this.showingPassword; + } + onSubmit(): void { this._userService.registerUserRequest(this.registerUserFormGroup).subscribe({ next: (res: object) => { @@ -60,6 +65,7 @@ export class RegisterComponent implements OnInit { } }); } + onRedirectLogin(): void { this._router.navigate(['/login']); } |
