clean code
This commit is contained in:
parent
c7e64d34c3
commit
e0677e9971
8 changed files with 56 additions and 73 deletions
|
|
@ -1,20 +1,25 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { RegisterComponent } from "./register/register.component";
|
||||
import { ChooseAvatarComponent } from "./choose-avatar/choose-avatar.component";
|
||||
import { LoginComponent } from "./login/login.component";
|
||||
import { PasswordForgetComponent } from "./password-forget/password-forget.component";
|
||||
import { PasswordResetComponent } from "./password-reset/password-reset.component";
|
||||
import { loginService } from '../../service/login.service';
|
||||
import { RegisterComponent } from './register/register.component';
|
||||
import { ChooseAvatarComponent } from './choose-avatar/choose-avatar.component';
|
||||
import { LoginComponent } from './login/login.component';
|
||||
import { PasswordForgetComponent } from './password-forget/password-forget.component';
|
||||
import { PasswordResetComponent } from './password-reset/password-reset.component';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-login',
|
||||
standalone: true,
|
||||
templateUrl: './main-login.component.html',
|
||||
styleUrl: './main-login.component.scss',
|
||||
imports: [CommonModule,RegisterComponent, ChooseAvatarComponent, LoginComponent, PasswordForgetComponent, PasswordResetComponent,RouterLink]
|
||||
selector: 'app-main-login',
|
||||
standalone: true,
|
||||
templateUrl: './main-login.component.html',
|
||||
styleUrl: './main-login.component.scss',
|
||||
imports: [
|
||||
CommonModule,
|
||||
RegisterComponent,
|
||||
ChooseAvatarComponent,
|
||||
LoginComponent,
|
||||
PasswordForgetComponent,
|
||||
PasswordResetComponent,
|
||||
RouterLink,
|
||||
],
|
||||
})
|
||||
export class MainLoginComponent {
|
||||
|
||||
}
|
||||
export class MainLoginComponent {}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { getAuth, sendPasswordResetEmail } from 'firebase/auth';
|
|||
import { Firestore } from '@angular/fire/firestore';
|
||||
import { Router } from '@angular/router';
|
||||
import { StartHeaderComponent } from '../../../shared/components/login/start-header/start-header.component';
|
||||
import { TranslateModule} from '@ngx-translate/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-password-forget',
|
||||
|
|
@ -22,21 +22,19 @@ import { TranslateModule} from '@ngx-translate/core';
|
|||
RouterModule,
|
||||
SmallBtnComponent,
|
||||
StartHeaderComponent,
|
||||
TranslateModule
|
||||
TranslateModule,
|
||||
],
|
||||
})
|
||||
|
||||
export class PasswordForgetComponent {
|
||||
email: string = '';
|
||||
emailSentBtn = false;
|
||||
firestore: Firestore = inject(Firestore);
|
||||
constructor(private router: Router) {}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Initiates a password reset process for the user.
|
||||
* Sends a password reset email to the user's registered email address.
|
||||
*
|
||||
*
|
||||
* @param ngForm The form data from the Angular form, used to manage form state.
|
||||
*/
|
||||
passwordReset(ngForm: NgForm) {
|
||||
|
|
@ -44,7 +42,7 @@ export class PasswordForgetComponent {
|
|||
sendPasswordResetEmail(auth, this.email)
|
||||
.then(() => {
|
||||
ngForm.resetForm(ngForm);
|
||||
this.router.navigate(['/login']);
|
||||
this.router.navigate(['/login']);
|
||||
})
|
||||
.catch((error) => {
|
||||
const errorCode = error.code;
|
||||
|
|
@ -52,10 +50,9 @@ export class PasswordForgetComponent {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Handles the form submission, invoking the password reset function and then sending a notification email.
|
||||
*
|
||||
*
|
||||
* @param ngForm The form instance containing user input.
|
||||
*/
|
||||
onSubmit(ngForm: NgForm) {
|
||||
|
|
@ -63,7 +60,6 @@ export class PasswordForgetComponent {
|
|||
this.sendEmail();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simulates sending an email by toggling a button state to show feedback to the user.
|
||||
* After a set timeout, resets the button state.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, inject } from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
import { FooterComponent } from '../../../shared/components/login/footer/footer.component';
|
||||
import { FormsModule, NgForm } from '@angular/forms';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
|
@ -21,7 +21,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||
FooterComponent,
|
||||
RouterModule,
|
||||
SmallBtnComponent,
|
||||
TranslateModule
|
||||
TranslateModule,
|
||||
],
|
||||
templateUrl: './password-reset.component.html',
|
||||
styleUrl: './password-reset.component.scss',
|
||||
|
|
@ -32,15 +32,11 @@ export class PasswordResetComponent {
|
|||
oobCode: string = '';
|
||||
private queryParamsSubscription: Subscription = new Subscription();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
) {}
|
||||
constructor(private route: ActivatedRoute, private router: Router) {}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the component by subscribing to query parameters.
|
||||
*/
|
||||
/**
|
||||
* Initializes the component by subscribing to query parameters.
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.queryParamsSubscription = this.route.queryParams.subscribe(
|
||||
(params) => {
|
||||
|
|
@ -49,20 +45,18 @@ export class PasswordResetComponent {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles the submission of the password reset form.
|
||||
* @param ngForm The form data of the password reset form.
|
||||
*/
|
||||
/**
|
||||
* Handles the submission of the password reset form.
|
||||
* @param ngForm The form data of the password reset form.
|
||||
*/
|
||||
onSubmit(ngForm: NgForm): void {
|
||||
this.resetPassword(ngForm);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performs the password reset operation using Firebase Authentication.
|
||||
* @param ngForm The form data of the password reset form.
|
||||
*/
|
||||
/**
|
||||
* Performs the password reset operation using Firebase Authentication.
|
||||
* @param ngForm The form data of the password reset form.
|
||||
*/
|
||||
resetPassword(ngForm: NgForm): void {
|
||||
const auth = getAuth();
|
||||
const newPassword = this.passwordRepeat;
|
||||
|
|
@ -76,19 +70,17 @@ export class PasswordResetComponent {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cleans up the component by unsubscribing from the query parameters subscription.
|
||||
*/
|
||||
* Cleans up the component by unsubscribing from the query parameters subscription.
|
||||
*/
|
||||
ngOnDestroy(): void {
|
||||
this.queryParamsSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the entered passwords match.
|
||||
* @returns true if the password and repeated password are the same.
|
||||
*/
|
||||
* Checks if the entered passwords match.
|
||||
* @returns true if the password and repeated password are the same.
|
||||
*/
|
||||
passwordsMatch(): boolean {
|
||||
return this.password === this.passwordRepeat;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import {
|
||||
AfterViewChecked,
|
||||
AfterViewInit,
|
||||
Component,
|
||||
ElementRef,
|
||||
Input,
|
||||
|
|
@ -10,12 +9,10 @@ import {
|
|||
import { UserService } from '../../service/user.service';
|
||||
import { ChannleService } from '../../service/channle.service';
|
||||
import { ChatService } from '../../service/chat.service';
|
||||
import { Channel } from '../../interface/channel.interface';
|
||||
import { MainComponent } from '../main/main.component';
|
||||
import { SingleChatComponent } from '../main-chat/single-chat/single-chat.component';
|
||||
import { Chat, ChatAnswers } from '../../interface/chat.interface';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { User } from '../../interface/user.interface';
|
||||
import { ChatMsgBoxComponent } from '../main-chat/chat-msg-box/chat-msg-box.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, RouterModule } from '@angular/router';
|
||||
import { SidebarChannelsComponent } from './sidebar-channels/sidebar-channels.component';
|
||||
import { SidebarDirectMessagesComponent } from './sidebar-direct-messages/sidebar-direct-messages.component';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Injectable, Input, OnInit } from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
getDownloadURL,
|
||||
getStorage,
|
||||
|
|
@ -23,7 +23,6 @@ export class DownloadFilesService {
|
|||
}
|
||||
|
||||
loadAllFiles(docID: string) {
|
||||
// lädt die fails in den firebase storage
|
||||
const storage = getStorage();
|
||||
for (const file of this.uploadFiles) {
|
||||
const storageRef = ref(storage, `chatFiles/${docID}/${file.name}`);
|
||||
|
|
@ -54,7 +53,6 @@ export class DownloadFilesService {
|
|||
|
||||
downloadedFilesData.push({ id: folderID, files: folderFiles });
|
||||
}
|
||||
|
||||
// Emit the updated value
|
||||
this.downloadedFiles.next(downloadedFilesData);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,14 +11,11 @@ export class LanguageService {
|
|||
this.translate.setDefaultLang(this.currentLang);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Switches the application's current language.
|
||||
*
|
||||
* This method sets the current language based on the specified `lang` parameter and updates the translation service to use the new language. This is useful for enabling runtime language switching in a multi-lingual application.
|
||||
*
|
||||
* @param lang The language code to switch to. Supported values are 'en' for English and 'de' for German.
|
||||
*/
|
||||
* Switches the application's current language.
|
||||
* This method sets the current language based on the specified `lang` parameter and updates the translation service to use the new language. This is useful for enabling runtime language switching in a multi-lingual application.
|
||||
* @param lang The language code to switch to. Supported values are 'en' for English and 'de' for German.
|
||||
*/
|
||||
switchLanguage() {
|
||||
this.currentLang = this.currentLang === 'en' ? 'de' : 'en';
|
||||
this.translate.use(this.currentLang);
|
||||
|
|
|
|||
|
|
@ -1,25 +1,23 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToggleBooleanService {
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
openSearchWindow: boolean = false;
|
||||
openChannelMemberWindow: boolean = false;
|
||||
closeChannelMemberWindow: boolean = false;
|
||||
openSearchWindowHead: boolean = false;
|
||||
selectUserInMsgBox:boolean = false;
|
||||
selectUserInMsgBox: boolean = false;
|
||||
isSidebarOpen: boolean = true;
|
||||
|
||||
|
||||
/**
|
||||
* Opens or closes the add member window based on the provided boolean value.
|
||||
* @param boolean A boolean value to determine whether to open or close the add member window.
|
||||
*/
|
||||
openAddMemberWindow(boolean : boolean){
|
||||
openAddMemberWindow(boolean: boolean) {
|
||||
this.closeChannelMemberWindow = boolean;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue