clean code & bugfixes
This commit is contained in:
parent
7e2b04771f
commit
3f013da226
6 changed files with 17 additions and 28 deletions
|
|
@ -55,10 +55,10 @@ export class AppComponent {
|
||||||
const startTime = localStorage.getItem('sessionTimeJOIN');
|
const startTime = localStorage.getItem('sessionTimeJOIN');
|
||||||
|
|
||||||
if (startTime) {
|
if (startTime) {
|
||||||
const startTimeMillis = parseInt(startTime);
|
const startTimeMills = parseInt(startTime);
|
||||||
const currentTime = new Date().getTime();
|
const currentTime = new Date().getTime();
|
||||||
const timeDifference = 12 * 60 * 60 * 1000; // 12h
|
const timeDifference = 12 * 60 * 60 * 1000; // 12h
|
||||||
if (currentTime - startTimeMillis > timeDifference) {
|
if (currentTime - startTimeMills > timeDifference) {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,8 @@ import { FormBtnComponent } from '../../../shared/components/buttons/form-btn/fo
|
||||||
import { FooterComponent } from '../footer/footer.component';
|
import { FooterComponent } from '../footer/footer.component';
|
||||||
import { HeaderComponent } from '../header/header.component';
|
import { HeaderComponent } from '../header/header.component';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { FirebaseService } from '../../../services/firebase.service';
|
|
||||||
import { LoginService } from '../../../services/login.service';
|
import { LoginService } from '../../../services/login.service';
|
||||||
import { SharedService } from '../../../services/shared.service';
|
import { SharedService } from '../../../services/shared.service';
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { BtnBackComponent } from '../../../shared/components/buttons/btn-back/btn-back.component';
|
import { BtnBackComponent } from '../../../shared/components/buttons/btn-back/btn-back.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -32,27 +30,18 @@ export class ForgotPwComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private firebaseService: FirebaseService,
|
public loginService: LoginService,
|
||||||
public loginSerivce: LoginService,
|
public sharedService: SharedService
|
||||||
public sharedService: SharedService,
|
|
||||||
private router: Router
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
onSubmit(ngForm: NgForm) {
|
onSubmit(ngForm: NgForm) {
|
||||||
this.sharedService.isBtnDisabled = true;
|
this.sharedService.isBtnDisabled = true;
|
||||||
if (ngForm.submitted && ngForm.form.valid) {
|
if (ngForm.submitted && ngForm.form.valid) {
|
||||||
this.loginSerivce.passwordReset(this.pwResetData.mail.toLowerCase());
|
this.loginService.passwordReset(this.pwResetData.mail.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
existEmailonServer(mail: string) {
|
|
||||||
return this.firebaseService
|
|
||||||
.getAllUsers()
|
|
||||||
.filter((user) => user.email === mail);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkIfUserEmailIsValid(emailValue: string) {
|
checkIfUserEmailIsValid(emailValue: string) {
|
||||||
const channelNameLenght = emailValue.length;
|
|
||||||
const emailRegex = /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{2,}$/;
|
const emailRegex = /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{2,}$/;
|
||||||
if (emailRegex.test(emailValue)) {
|
if (emailRegex.test(emailValue)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
!sharedService.isBtnDisabled) {
|
!sharedService.isBtnDisabled) {
|
||||||
<p>{{ "register.errorMail1" | translate }}</p>
|
<p>{{ "register.errorMail1" | translate }}</p>
|
||||||
} @else { @if
|
} @else { @if
|
||||||
(existEmailonServer(registerData.mail.toLowerCase()).length > 0 &&
|
(existEmailOnServer(registerData.mail.toLowerCase()).length > 0 &&
|
||||||
!sharedService.isBtnDisabled) {
|
!sharedService.isBtnDisabled) {
|
||||||
<p>{{ "register.errorMail2" | translate }}</p>
|
<p>{{ "register.errorMail2" | translate }}</p>
|
||||||
} } }
|
} } }
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
id="password"
|
id="password"
|
||||||
name="password"
|
name="password"
|
||||||
#password="ngModel"
|
#password="ngModel"
|
||||||
[type]="loginSerivce.passwordFieldType"
|
[type]="loginService.passwordFieldType"
|
||||||
placeholder="{{ 'register.password' | translate }}"
|
placeholder="{{ 'register.password' | translate }}"
|
||||||
class="custom-input"
|
class="custom-input"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
|
|
@ -104,8 +104,8 @@
|
||||||
} @else {
|
} @else {
|
||||||
<img
|
<img
|
||||||
class="passwordEye"
|
class="passwordEye"
|
||||||
(click)="loginSerivce.togglePasswordVisibility()"
|
(click)="loginService.togglePasswordVisibility()"
|
||||||
[src]="loginSerivce.passwordIcon"
|
[src]="loginService.passwordIcon"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<div class="error-msg">
|
<div class="error-msg">
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
id="passwordConfirm"
|
id="passwordConfirm"
|
||||||
name="passwordConfirm"
|
name="passwordConfirm"
|
||||||
#passwordConfirm="ngModel"
|
#passwordConfirm="ngModel"
|
||||||
[type]="loginSerivce.passwordFieldType"
|
[type]="loginService.passwordFieldType"
|
||||||
placeholder="{{ 'register.passwordConfirm' | translate }}"
|
placeholder="{{ 'register.passwordConfirm' | translate }}"
|
||||||
class="custom-input"
|
class="custom-input"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
|
|
@ -139,8 +139,8 @@
|
||||||
} @else {
|
} @else {
|
||||||
<img
|
<img
|
||||||
class="passwordEyeConfirm"
|
class="passwordEyeConfirm"
|
||||||
(click)="loginSerivce.togglePasswordVisibility()"
|
(click)="loginService.togglePasswordVisibility()"
|
||||||
[src]="loginSerivce.passwordIcon"
|
[src]="loginService.passwordIcon"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<div class="error-msg">
|
<div class="error-msg">
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export class RegisterComponent {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private firebaseService: FirebaseService,
|
private firebaseService: FirebaseService,
|
||||||
public loginSerivce: LoginService,
|
public loginService: LoginService,
|
||||||
public sharedService: SharedService,
|
public sharedService: SharedService,
|
||||||
public translateService: TranslateService
|
public translateService: TranslateService
|
||||||
) {}
|
) {}
|
||||||
|
|
@ -51,7 +51,7 @@ export class RegisterComponent {
|
||||||
this.sharedService.isBtnDisabled = true;
|
this.sharedService.isBtnDisabled = true;
|
||||||
if (ngForm.submitted && ngForm.form.valid) {
|
if (ngForm.submitted && ngForm.form.valid) {
|
||||||
this.splitName();
|
this.splitName();
|
||||||
this.loginSerivce.register(this.registerData);
|
this.loginService.register(this.registerData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ export class RegisterComponent {
|
||||||
this.registerData.lastName = names.slice(1).join(' ');
|
this.registerData.lastName = names.slice(1).join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
existEmailonServer(mail: string) {
|
existEmailOnServer(mail: string) {
|
||||||
return this.firebaseService
|
return this.firebaseService
|
||||||
.getAllUsers()
|
.getAllUsers()
|
||||||
.filter((user) => user.email === mail);
|
.filter((user) => user.email === mail);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
'switch-language': languageService.currentLang == 'de'
|
'switch-language': languageService.currentLang == 'de'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<img src="./assets/img/sidebar/summary.svg" alt="sumary" /><span>{{
|
<img src="./assets/img/sidebar/summary.svg" alt="summary" /><span>{{
|
||||||
"sidebar.summary" | translate
|
"sidebar.summary" | translate
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@
|
||||||
},
|
},
|
||||||
"contactDeleteDialog": {
|
"contactDeleteDialog": {
|
||||||
"deleteContact": "Möchten Sie den Kontakt wirklich löschen?",
|
"deleteContact": "Möchten Sie den Kontakt wirklich löschen?",
|
||||||
"btnCancle": "Abbrechen",
|
"btnCancel": "Abbrechen",
|
||||||
"btnDelete": "Löschen"
|
"btnDelete": "Löschen"
|
||||||
},
|
},
|
||||||
"summary": {
|
"summary": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue