diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 54ccf57..6550c31 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -10,6 +10,7 @@ import { TaskOverlayComponent } from './shared/components/overlay/task-overlay/t import { TaskEditOverlayComponent } from './shared/components/overlay/task-edit-overlay/task-edit-overlay.component'; import { LoginComponent } from './components/login/login.component'; import { RegisterComponent } from './components/login/register/register.component'; +import { ForgotPwComponent } from './components/login/forgot-pw/forgot-pw.component'; export const routes: Routes = [ { path: '', component: SummaryComponent }, @@ -17,6 +18,7 @@ export const routes: Routes = [ { path: 'login/imprint', component: ImprintComponent }, { path: 'login/privacy-policy', component: PrivacyPolicyComponent }, { path: 'register', component: RegisterComponent }, + { path: 'forgot-pw', component: ForgotPwComponent }, { path: 'summary', component: SummaryComponent }, { path: 'add-task', component: AddTaskComponent }, { path: 'add-task/:id', component: AddTaskComponent }, diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.html b/src/app/components/login/forgot-pw/forgot-pw.component.html new file mode 100644 index 0000000..83bd41a --- /dev/null +++ b/src/app/components/login/forgot-pw/forgot-pw.component.html @@ -0,0 +1,63 @@ + + + + + {{ "forgotPW.forgot" | translate }} + + + + + + @if(!pwResetData.mail) { + + } @else { + + } + + @if (!mail.valid && mail.touched) { + {{ "forgotPW.errorMail0" | translate }} + } @if (loginSerivce.errorCode == 'auth/invalid-email') { + {{ "forgotPW.errorMail1" | translate }} + } + + + + {{ "forgotPW.notice" | translate }} + + + + + + + + + diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.scss b/src/app/components/login/forgot-pw/forgot-pw.component.scss new file mode 100644 index 0000000..85552cf --- /dev/null +++ b/src/app/components/login/forgot-pw/forgot-pw.component.scss @@ -0,0 +1,219 @@ +section { + width: 100vw; + height: 100vh; +} + +.content { + display: flex; + flex-direction: column; + align-items: center; + position: fixed; + top: 50%; + right: 50%; + transform: translate(50%, -50%); + width: 722px; + height: fit-content; + background: var(--white); + box-shadow: 0px 0px 12px 3px rgba(0, 0, 0, 0.05); + border-radius: 30px; + padding: 48px 64px; + .headline { + text-align: center; + font-size: 61px; + font-weight: 700; + } + img { + padding: 12px 0 24px 0; + } +} + +.input-fields { + display: flex; + flex-direction: column; + align-items: center; + position: relative; + width: 90%; + .custom-input::-webkit-contacts-auto-fill-button { + visibility: hidden; + } + .custom-input { + font-size: 20px; + font-weight: 400; + width: 100%; + border-radius: 10px; + border: 1px solid var(--light-gray); + padding: 12px 16px; + } + .custom-img { + &:nth-child(2) { + position: absolute; + right: 0; + top: 5px; + } + &:nth-child(5) { + position: absolute; + right: 0; + top: 88px; + } + } + .passwordEye { + position: absolute; + right: -5px; + top: 88px; + } + .custom-input:focus + .custom-img { + display: none; + } +} + +.error-msg { + display: flex; + align-items: center; + justify-content: center; + height: 24px; + padding: 6px; + width: 120%; + p { + color: var(--red); + font-size: 12px !important; + font-weight: 400 !important; + } +} + +.form-buttons { + display: flex; + justify-content: end; + padding: 12px 0; +} + +.notice { + text-align: center; + padding: 12px; + p { + color: var(--gray); + font-size: 21px; + font-weight: 400; + } +} + +/*------------- RESPONSIVE -------------*/ + +@media (max-height: 800px) { + .content { + top: 40%; + } +} + +@media screen and (max-width: 850px) { + .content { + width: 552px; + height: fit-content; + padding: 24px 36px; + .headline { + font-size: 47px; + } + .line { + img { + width: 120px; + } + } + } +} + +@media screen and (max-width: 650px) { + .content { + width: 352px; + height: fit-content; + padding: 24px 36px; + .headline { + font-size: 36px; + } + .line { + img { + width: 100px; + } + } + } + + .notice { + p { + font-size: 18px; + } + } +} + +@media screen and (max-width: 450px) { + .content { + width: calc(100vw - 96px); + padding: 24px 36px; + .headline { + font-size: 36px; + } + .line { + img { + width: 100px; + } + } + } + + .loading-text { + margin-top: 180px; + p { + font-size: 18px; + font-weight: 400px; + } + } + + .error-msg { + height: 21px; + p { + font-size: 11px !important; + } + } +} + +@media screen and (max-width: 360px) { + .content { + width: calc(100vw - 72px); + padding: 12px 24px; + .headline { + font-size: 32px; + } + .line { + img { + width: 80px; + } + } + } + + .input-fields { + .custom-input { + font-size: 16px; + padding: 12px; + } + .custom-img { + &:nth-child(2) { + top: 2px; + } + &:nth-child(5) { + top: 73px; + } + } + .passwordEye { + top: 76px; + } + } + + .error-msg { + height: 18px; + p { + font-size: 10px !important; + } + } + + .notice { + p { + font-size: 16px; + } + } +} diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.spec.ts b/src/app/components/login/forgot-pw/forgot-pw.component.spec.ts new file mode 100644 index 0000000..10f5909 --- /dev/null +++ b/src/app/components/login/forgot-pw/forgot-pw.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ForgotPwComponent } from './forgot-pw.component'; + +describe('ForgotPwComponent', () => { + let component: ForgotPwComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ForgotPwComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ForgotPwComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.ts b/src/app/components/login/forgot-pw/forgot-pw.component.ts new file mode 100644 index 0000000..ceaad8e --- /dev/null +++ b/src/app/components/login/forgot-pw/forgot-pw.component.ts @@ -0,0 +1,57 @@ +import { CommonModule } from '@angular/common'; +import { Component } from '@angular/core'; +import { FormsModule, NgForm } from '@angular/forms'; +import { FormBtnComponent } from '../../../shared/components/buttons/form-btn/form-btn.component'; +import { FooterComponent } from '../footer/footer.component'; +import { HeaderComponent } from '../header/header.component'; +import { TranslateModule } from '@ngx-translate/core'; +import { LoadingDialogComponent } from '../loading-dialog/loading-dialog.component'; +import { FirebaseService } from '../../../services/firebase.service'; +import { LoginService } from '../../../services/login.service'; +import { SharedService } from '../../../services/shared.service'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-forgot-pw', + standalone: true, + imports: [ + FormsModule, + CommonModule, + FormBtnComponent, + FooterComponent, + HeaderComponent, + TranslateModule, + LoadingDialogComponent, + ], + templateUrl: './forgot-pw.component.html', + styleUrl: './forgot-pw.component.scss', +}) +export class ForgotPwComponent { + pwResetData = { + mail: '', + }; + + constructor( + private firebaseService: FirebaseService, + public loginSerivce: LoginService, + public sharedService: SharedService, + private router: Router + ) {} + + onSubmit(ngForm: NgForm) { + this.sharedService.isBtnDisabled = true; + if (ngForm.submitted && ngForm.form.valid) { + // this.loginSerivce.login(this.pwResetData); + } + } + + checkIfUserEmailIsValid(emailValue: string) { + const channelNameLenght = emailValue.length; + const emailRegex = /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{2,}$/; + if (emailRegex.test(emailValue)) { + return true; + } else { + return false; + } + } +} diff --git a/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.html b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.html new file mode 100644 index 0000000..1600c84 --- /dev/null +++ b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.html @@ -0,0 +1,99 @@ + + + + + {{ "login.login" | translate }} + + + + + + @if(!pwResetData.password) { + + } @else { + + } + + @if (!password.valid && password.touched) { + {{ "register.errorPassword0" | translate }} + } @else { @if (pwResetData.password.length < 6 && password.touched) { + {{ "register.errorPassword1" | translate }} + } } + + + @if(!pwResetData.passwordConfirm) { + + } @else { + + } + + @if (!passwordConfirm.valid && passwordConfirm.touched) { + {{ "register.errorPassword0" | translate }} + } @if (pwResetData.password !== pwResetData.passwordConfirm && + pwResetData.password !== "" && pwResetData.passwordConfirm !== "") { + {{ "register.errorPassword2" | translate }} + } + + + + + + + + + + diff --git a/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.scss b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.spec.ts b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.spec.ts new file mode 100644 index 0000000..5cd18ec --- /dev/null +++ b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PwResetComponent } from './pw-reset.component'; + +describe('PwResetComponent', () => { + let component: PwResetComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [PwResetComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PwResetComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.ts b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.ts new file mode 100644 index 0000000..d15beed --- /dev/null +++ b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.ts @@ -0,0 +1,48 @@ +import { CommonModule } from '@angular/common'; +import { Component } from '@angular/core'; +import { FormsModule, NgForm } from '@angular/forms'; +import { FormBtnComponent } from '../../../../shared/components/buttons/form-btn/form-btn.component'; +import { FooterComponent } from '../../footer/footer.component'; +import { HeaderComponent } from '../../header/header.component'; +import { TranslateModule } from '@ngx-translate/core'; +import { LoadingDialogComponent } from '../../loading-dialog/loading-dialog.component'; +import { FirebaseService } from '../../../../services/firebase.service'; +import { LoginService } from '../../../../services/login.service'; +import { Router } from '@angular/router'; +import { SharedService } from '../../../../services/shared.service'; + +@Component({ + selector: 'app-pw-reset', + standalone: true, + imports: [ + FormsModule, + CommonModule, + FormBtnComponent, + FooterComponent, + HeaderComponent, + TranslateModule, + LoadingDialogComponent, + ], + templateUrl: './pw-reset.component.html', + styleUrl: './pw-reset.component.scss', +}) +export class PwResetComponent { + pwResetData = { + password: '', + passwordConfirm: '', + }; + + constructor( + private firebaseService: FirebaseService, + public loginSerivce: LoginService, + public sharedService: SharedService, + private router: Router + ) {} + + onSubmit(ngForm: NgForm) { + this.sharedService.isBtnDisabled = true; + if (ngForm.submitted && ngForm.form.valid) { + // this.loginSerivce.login(this.pwResetData); + } + } +} diff --git a/src/app/components/login/login.component.html b/src/app/components/login/login.component.html index 0a1bcba..6be6e12 100644 --- a/src/app/components/login/login.component.html +++ b/src/app/components/login/login.component.html @@ -72,6 +72,9 @@ {{ "login.errorPassword1" | translate }} } + + Passwort vergessen? +
{{ "forgotPW.errorMail0" | translate }}
{{ "forgotPW.errorMail1" | translate }}
{{ "forgotPW.notice" | translate }}
{{ "login.login" | translate }}
{{ "register.errorPassword0" | translate }}
{{ "register.errorPassword1" | translate }}
{{ "register.errorPassword2" | translate }}
{{ "login.errorPassword1" | translate }}