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: 'login/notice/:id', component: LoginComponent },
{ path: 'register', component: RegisterComponent }, { path: 'register', component: RegisterComponent },
{ path: 'forgot-pw', component: ForgotPwComponent }, { 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/imprint', component: ImprintComponent },
{ path: 'login/privacy-policy', component: PrivacyPolicyComponent }, { path: 'login/privacy-policy', component: PrivacyPolicyComponent },
], ],
@ -51,4 +51,5 @@ export const routes: Routes = [
{ path: 'privacy-policy', component: PrivacyPolicyComponent }, { path: 'privacy-policy', component: PrivacyPolicyComponent },
], ],
}, },
{ path: '**', component: LoginComponent },
]; ];

View file

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

View file

@ -67,18 +67,25 @@ section {
top: 102px; top: 102px;
} }
} }
.passwordEye {
position: absolute; .passwordEye,
right: -5px;
top: 15px;
cursor: pointer;
}
.passwordEyeConfirm { .passwordEyeConfirm {
position: absolute; position: absolute;
right: -5px; right: -5px;
top: 102px; top: 15px;
transition: filter 0.3s ease;
cursor: pointer; 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 { .custom-input:focus + .custom-img {
display: none; display: none;
} }

View file

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

View file

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