fix: minor bugfixes

This commit is contained in:
Chneemann 2025-04-18 06:25:24 +02:00
parent be468cabd6
commit 8d513ea299
5 changed files with 28 additions and 16 deletions

View file

@ -28,7 +28,7 @@ export const routes: Routes = [
{ path: 'login/notice/:id', component: LoginComponent },
{ path: 'register', component: RegisterComponent },
{ path: 'forgot-pw', component: ForgotPwComponent },
{ path: 'pw-reset/:uid/:token', component: PwResetComponent },
{ path: 'pw-reset/:uidb64/:token', component: PwResetComponent },
{ path: 'login/imprint', component: ImprintComponent },
{ path: 'login/privacy-policy', component: PrivacyPolicyComponent },
],
@ -51,4 +51,5 @@ export const routes: Routes = [
{ path: 'privacy-policy', component: PrivacyPolicyComponent },
],
},
{ path: '**', component: LoginComponent },
];

View file

@ -34,13 +34,15 @@ export class ForgotPwComponent {
private authService: AuthService
) {}
onSubmit(ngForm: NgForm) {
async onSubmit(ngForm: NgForm) {
this.buttonStateService.disableButton();
if (ngForm.submitted && ngForm.form.valid) {
try {
this.authService.resetPassword(this.pwResetData.mail.toLowerCase());
await this.authService.resetPassword(
this.pwResetData.mail.toLowerCase()
);
this.buttonStateService.enableButton();
} catch (error: any) {
} catch (error) {
this.buttonStateService.enableButton();
}
} else {

View file

@ -67,18 +67,25 @@ section {
top: 102px;
}
}
.passwordEye {
position: absolute;
right: -5px;
top: 15px;
cursor: pointer;
}
.passwordEye,
.passwordEyeConfirm {
position: absolute;
right: -5px;
top: 102px;
top: 15px;
transition: filter 0.3s ease;
cursor: pointer;
&:hover {
filter: brightness(0) saturate(100%) invert(53%) sepia(83%) saturate(480%)
hue-rotate(155deg) brightness(94%) contrast(88%);
}
}
.passwordEyeConfirm {
top: 102px;
}
.custom-input:focus + .custom-img {
display: none;
}

View file

@ -26,7 +26,7 @@ import { PasswordVisibilityService } from '../../../../services/password-visibil
styleUrl: './pw-reset.component.scss',
})
export class PwResetComponent implements OnInit, OnDestroy {
uid: string = '';
uidb64: string = '';
token: string = '';
errorHttpMessage: string = '';
@ -55,7 +55,7 @@ export class PwResetComponent implements OnInit, OnDestroy {
routeParams() {
this.route.params.pipe(takeUntil(this.destroy$)).subscribe((params) => {
this.uid = params['uid'];
this.uidb64 = params['uidb64'];
this.token = params['token'];
});
}
@ -68,9 +68,10 @@ export class PwResetComponent implements OnInit, OnDestroy {
this.buttonStateService.disableButton();
if (ngForm.submitted && ngForm.form.valid) {
try {
console.log(this.uidb64, this.token);
await this.authService.resetPasswordConfirm(
this.pwResetData.password,
this.uid,
this.uidb64,
this.token
);
this.buttonStateService.enableButton();

View file

@ -83,17 +83,18 @@ export class AuthService {
this.apiService.request('POST', `/auth/reset/`, { email })
);
this.toastNotificationService.resetPasswordSuccessToast();
this.router.navigate(['/login']);
} catch (error) {
console.error('Password reset failed:', error);
}
}
async resetPasswordConfirm(password: string, uid: string, token: string) {
async resetPasswordConfirm(password: string, uidb64: string, token: string) {
try {
await lastValueFrom(
this.apiService.request('POST', `/auth/reset/confirm/`, {
password,
uid,
uidb64,
token,
})
);