added forgot password component & design improvements
This commit is contained in:
parent
94717e053c
commit
3b20deaf56
14 changed files with 151 additions and 35 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
import { HomeComponent } from './components/home/home.component';
|
import { HomeComponent } from './components/home/home.component';
|
||||||
import { RegisterComponent } from './components/auth/register/register.component';
|
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{ path: '', component: HomeComponent },
|
{ path: '', component: HomeComponent },
|
||||||
{ path: 'login', component: HomeComponent },
|
{ path: 'login', component: HomeComponent },
|
||||||
{ path: 'register', component: HomeComponent },
|
{ path: 'register', component: HomeComponent },
|
||||||
|
{ path: 'forgot-password', component: HomeComponent },
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<section>
|
||||||
|
<div class="content">
|
||||||
|
<div class="headline">Forgot your password?</div>
|
||||||
|
@if (sendSuccess) {
|
||||||
|
<div class="note">
|
||||||
|
<p>
|
||||||
|
If the email you entered exists on our server, you will receive a
|
||||||
|
message with instructions on how to reset your password.
|
||||||
|
</p>
|
||||||
|
<a href="/login">To the login</a>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="note">
|
||||||
|
<p>We will send you an email with instructions to reset your password.</p>
|
||||||
|
</div>
|
||||||
|
<form
|
||||||
|
#taskForm="ngForm"
|
||||||
|
(ngSubmit)="onSubmit(taskForm, mail)"
|
||||||
|
onsubmit="return false"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="mail"
|
||||||
|
id="mail"
|
||||||
|
name="mail"
|
||||||
|
#mail="ngModel"
|
||||||
|
placeholder="Email Address"
|
||||||
|
class="custom-input"
|
||||||
|
autocomplete="email"
|
||||||
|
[(ngModel)]="authData.mail"
|
||||||
|
[class.error-border]="
|
||||||
|
(!mail.valid && mail.touched) ||
|
||||||
|
(mail.touched &&
|
||||||
|
!isUserEmailValid(authData.mail.toLowerCase()) &&
|
||||||
|
authData.mail.length > 0)
|
||||||
|
"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<div class="error-msg">
|
||||||
|
@if (!mail.valid && mail.touched) {
|
||||||
|
<p>Please enter your email</p>
|
||||||
|
} @else { @if (mail.touched && authData.mail.length > 0 &&
|
||||||
|
!isUserEmailValid(authData.mail.toLowerCase())) {
|
||||||
|
<p>This is not a valid email format</p>
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
<app-btn-large
|
||||||
|
[value]="'Send Email'"
|
||||||
|
[disabled]="!isUserEmailValid(authData.mail)"
|
||||||
|
></app-btn-large>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
@import "./../../../../assets/style/colors.scss";
|
||||||
|
@import "./../../../../assets/style/form.scss";
|
||||||
|
@import "./../../../../assets/style/auth-layout.scss";
|
||||||
|
|
||||||
|
section {
|
||||||
|
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
|
||||||
|
url(./../../../../assets/img/backgrounds/forgot-password.png);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ForgotPasswordComponent } from './forgot-password.component';
|
||||||
|
|
||||||
|
describe('ForgotPasswordComponent', () => {
|
||||||
|
let component: ForgotPasswordComponent;
|
||||||
|
let fixture: ComponentFixture<ForgotPasswordComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ForgotPasswordComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ForgotPasswordComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { BtnLargeComponent } from '../../../shared/components/btn-large/btn-large.component';
|
||||||
|
import { FormsModule, NgForm } from '@angular/forms';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-forgot-password',
|
||||||
|
standalone: true,
|
||||||
|
imports: [CommonModule, BtnLargeComponent, FormsModule],
|
||||||
|
templateUrl: './forgot-password.component.html',
|
||||||
|
styleUrl: './forgot-password.component.scss',
|
||||||
|
})
|
||||||
|
export class ForgotPasswordComponent {
|
||||||
|
authData = {
|
||||||
|
mail: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
sendSuccess: boolean = false;
|
||||||
|
|
||||||
|
isUserEmailValid(emailValue: string) {
|
||||||
|
const emailRegex = /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{2,}$/;
|
||||||
|
return emailRegex.test(emailValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit(ngForm: NgForm, mailInput: any) {
|
||||||
|
if (ngForm.submitted && ngForm.form.valid) {
|
||||||
|
console.log(this.authData);
|
||||||
|
ngForm.form.reset();
|
||||||
|
this.sendSuccess = true;
|
||||||
|
} else {
|
||||||
|
mailInput.control.markAsTouched();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@ section {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
input {
|
input {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
|
@ -30,10 +31,7 @@ section {
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
position: absolute;
|
margin-top: 36px;
|
||||||
bottom: 43px;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
a {
|
a {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
<section>
|
<section>
|
||||||
<div
|
<div class="content">
|
||||||
class="content"
|
|
||||||
[ngStyle]="{ height: registrationSuccess ? '200px' : '492px' }"
|
|
||||||
>
|
|
||||||
<div class="headline">Sign Up</div>
|
<div class="headline">Sign Up</div>
|
||||||
@if (registrationSuccess) {
|
@if (registrationSuccess) {
|
||||||
<div class="reg-success">
|
<div class="note">
|
||||||
<p>
|
<p>
|
||||||
Please check your email to confirm your email address and complete the
|
Please check your email to confirm your email address and complete the
|
||||||
registration process.
|
registration process.
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,3 @@ section {
|
||||||
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
|
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
|
||||||
url(./../../../../assets/img/backgrounds/register.png);
|
url(./../../../../assets/img/backgrounds/register.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
.reg-success {
|
|
||||||
p {
|
|
||||||
color: $black;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 400;
|
|
||||||
margin: 36px 0 24px 0;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: $blue;
|
|
||||||
text-decoration: none;
|
|
||||||
cursor: pointer;
|
|
||||||
&:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,8 @@
|
||||||
<app-auth *ngIf="currentRoute === ''"></app-auth>
|
<app-auth *ngIf="currentRoute === ''"></app-auth>
|
||||||
<app-login *ngIf="currentRoute === 'login'"></app-login>
|
<app-login *ngIf="currentRoute === 'login'"></app-login>
|
||||||
<app-register *ngIf="currentRoute === 'register'"></app-register>
|
<app-register *ngIf="currentRoute === 'register'"></app-register>
|
||||||
|
<app-forgot-password
|
||||||
|
*ngIf="currentRoute === 'forgot-password'"
|
||||||
|
></app-forgot-password>
|
||||||
<app-footer></app-footer>
|
<app-footer></app-footer>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||||
import { RegisterComponent } from '../auth/register/register.component';
|
import { RegisterComponent } from '../auth/register/register.component';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { LoginComponent } from '../auth/login/login.component';
|
import { LoginComponent } from '../auth/login/login.component';
|
||||||
|
import { ForgotPasswordComponent } from '../auth/forgot-password/forgot-password.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
|
|
@ -17,6 +18,7 @@ import { LoginComponent } from '../auth/login/login.component';
|
||||||
AuthComponent,
|
AuthComponent,
|
||||||
RegisterComponent,
|
RegisterComponent,
|
||||||
LoginComponent,
|
LoginComponent,
|
||||||
|
ForgotPasswordComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './home.component.html',
|
templateUrl: './home.component.html',
|
||||||
styleUrl: './home.component.scss',
|
styleUrl: './home.component.scss',
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
border: 1px solid $white;
|
border: 1px solid $blue;
|
||||||
}
|
}
|
||||||
&:disabled {
|
&:disabled {
|
||||||
background-color: $gray;
|
background-color: $light-blue;
|
||||||
color: darken($gray, 20%);
|
color: darken($white, 10%);
|
||||||
border: 1px solid $gray;
|
border: 1px solid $gray;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
frontend/src/assets/img/backgrounds/forgot-password.png
Normal file
BIN
frontend/src/assets/img/backgrounds/forgot-password.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 998 KiB |
|
|
@ -18,7 +18,7 @@ section {
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
width: 520px;
|
width: 520px;
|
||||||
height: 492px;
|
height: fit-content;
|
||||||
padding: 43px 56px;
|
padding: 43px 56px;
|
||||||
border-radius: 48px;
|
border-radius: 48px;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
|
|
@ -28,7 +28,23 @@ section {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
}
|
}
|
||||||
app-btn-large {
|
}
|
||||||
margin-top: 36px;
|
|
||||||
|
.note {
|
||||||
|
p {
|
||||||
|
color: $black;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 400;
|
||||||
|
margin: 36px 0 24px 0;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: $blue;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,5 @@ $white: #fff;
|
||||||
$black: #000;
|
$black: #000;
|
||||||
$gray: #ababab;
|
$gray: #ababab;
|
||||||
$blue: #2e3edf;
|
$blue: #2e3edf;
|
||||||
|
$light-blue: #969eef;
|
||||||
$red: #ff002e;
|
$red: #ff002e;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue