From 93000fd4c71a6587025a77cf6d4bb833f2e6d55e Mon Sep 17 00:00:00 2001
From: Chneemann
Date: Sun, 23 Mar 2025 19:58:26 +0100
Subject: [PATCH] feat: migrate login, logout, and auth guards to Django Rest
---
.../login/forgot-pw/forgot-pw.component.ts | 2 +-
.../forgot-pw/pw-reset/pw-reset.component.ts | 2 +-
src/app/components/login/login.component.html | 14 +-
src/app/components/login/login.component.ts | 21 +-
.../login/register/register.component.ts | 2 +-
src/app/guards/authenticated.guard.ts | 12 +-
.../guards/redirect-if-authenticated.guard.ts | 11 +-
src/app/services/auth.service.ts | 390 +++---------------
src/app/services/login.service.ts | 361 ++++++++++++++++
.../header/navbar/navbar.component.ts | 6 +-
.../components/sidebar/sidebar.component.ts | 2 +-
11 files changed, 457 insertions(+), 366 deletions(-)
mode change 100644 => 100755 src/app/services/auth.service.ts
create mode 100644 src/app/services/login.service.ts
diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.ts b/src/app/components/login/forgot-pw/forgot-pw.component.ts
index dfc3237..b20a6c2 100644
--- a/src/app/components/login/forgot-pw/forgot-pw.component.ts
+++ b/src/app/components/login/forgot-pw/forgot-pw.component.ts
@@ -5,7 +5,7 @@ import { FormBtnComponent } from '../../../shared/components/buttons/form-btn/fo
import { FooterComponent } from '../footer/footer.component';
import { HeaderComponent } from '../header/header.component';
import { TranslateModule } from '@ngx-translate/core';
-import { LoginService } from '../../../services/auth.service';
+import { LoginService } from '../../../services/login.service';
import { SharedService } from '../../../services/shared.service';
import { BtnBackComponent } from '../../../shared/components/buttons/btn-back/btn-back.component';
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
index 2577313..18771e7 100644
--- 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
@@ -6,7 +6,7 @@ import { FooterComponent } from '../../footer/footer.component';
import { HeaderComponent } from '../../header/header.component';
import { TranslateModule } from '@ngx-translate/core';
import { FirebaseService } from '../../../../services/firebase.service';
-import { LoginService } from '../../../../services/auth.service';
+import { LoginService } from '../../../../services/login.service';
import { ActivatedRoute, Router } from '@angular/router';
import { SharedService } from '../../../../services/shared.service';
import { Subscription } from 'rxjs';
diff --git a/src/app/components/login/login.component.html b/src/app/components/login/login.component.html
index 674be76..52268e3 100644
--- a/src/app/components/login/login.component.html
+++ b/src/app/components/login/login.component.html
@@ -20,10 +20,10 @@
placeholder="{{ 'login.email' | translate }}"
class="custom-input"
autocomplete="email"
- [(ngModel)]="loginData.mail"
+ [(ngModel)]="loginData.email"
required
/>
- @if(!loginData.mail) {
+ @if(!loginData.email) {
{{ "login.errorMail1" | translate }}
} @if (mail.valid && mail.touched &&
- !checkIfUserEmailIsValid(loginData.mail.toLowerCase()) &&
+ !checkIfUserEmailIsValid(loginData.email.toLowerCase()) &&
!sharedService.isBtnDisabled) {
{{ "login.errorMail2" | translate }}
}
@@ -87,6 +87,7 @@
}}
+