|
|
|
|
@ -41,18 +41,30 @@ passwordType2: string = 'password';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
// Call the method to check if first-time login
|
|
|
|
|
this.checkIfFirstTimeChangePasswordOrNot();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkIfFirstTimeChangePasswordOrNot(){
|
|
|
|
|
let currentUser: any = JSON.parse(this.storageService.getItem('user')!)
|
|
|
|
|
if(currentUser.user.isFirstLogin){
|
|
|
|
|
checkIfFirstTimeChangePasswordOrNot() {
|
|
|
|
|
const fromMenu = history.state?.['fromMenu'];
|
|
|
|
|
|
|
|
|
|
if (fromMenu) {
|
|
|
|
|
this.isFirstLogin = false;
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
const currentUser: any = JSON.parse(this.storageService.getItem('user') || '{}');
|
|
|
|
|
|
|
|
|
|
// Check if user exists and has isFirstLogin flag
|
|
|
|
|
if (currentUser?.user?.isFirstLogin) {
|
|
|
|
|
this.isFirstLogin = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.isFirstLogin = false;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Error parsing user data:', error);
|
|
|
|
|
this.isFirstLogin = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|