reverse sessionId to user

This commit is contained in:
Chneemann 2024-05-25 09:21:07 +02:00
parent 0385d3ce56
commit 9708d370e0
3 changed files with 0 additions and 19 deletions

View file

@ -56,7 +56,6 @@ export class ContactFormComponent implements OnInit, OnChanges {
color: '',
status: false,
lastLogin: 0,
sessionId: '',
};
ngOnInit() {

View file

@ -9,5 +9,4 @@ export interface User {
color: string;
status: boolean;
lastLogin: number;
sessionId: string;
}

View file

@ -87,7 +87,6 @@ export class LoginService {
: '',
color: this.sharedService.generateRandomColor(),
lastLogin: new Date().getTime(),
sessionId: this.generateRandomString(30),
};
this.createUserInFirestore(userDataToSave);
})
@ -122,7 +121,6 @@ export class LoginService {
initials: firstName.slice(0, 1) + lastName.slice(0, 1),
color: this.sharedService.generateRandomColor(),
lastLogin: 0,
sessionId: this.generateRandomString(30),
});
} else {
this.ifExistUser(user.uid);
@ -145,7 +143,6 @@ export class LoginService {
initials: user.initials,
color: user.color,
lastLogin: new Date().getTime(),
sessionId: this.generateRandomString(30),
};
const usersCollection = collection(this.firestore, 'users');
try {
@ -168,7 +165,6 @@ export class LoginService {
await updateDoc(doc(collection(this.firestore, 'users'), userId), {
status: status,
lastLogin: new Date().getTime(),
sessionId: this.generateRandomString(30),
});
window.location.reload();
}
@ -190,19 +186,6 @@ export class LoginService {
localStorage.setItem('currentUserJOIN', JSON.stringify(userId));
}
generateRandomString(length: number): string {
const characters =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+{}:"<>?|[];\',./`~';
let result = '';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
// LOGOUT
logout(userId: string) {