Skip to content

Commit f3b6f9e

Browse files
committed
feat: improve password reset feedback and add back to login button
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent 868677f commit f3b6f9e

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

frontend/src/app/shared/components/auth/password-reset/finish/password-reset-finish.component.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ <h6 class="font-weight-light text-blue-800">Password reset</h6>
1313
<span>The password reset key is missing.</span>
1414
</div>
1515
<div *ngIf="error" class="alert alert-warning alert-styled-right flex-wrap mb-2">
16-
<span>Your password couldn't be reset. Remember a password request is only valid for 24 hours.</span>
16+
<span>{{ error }}</span>
1717
</div>
1818
<p *ngIf="success" class="alert bg-success-400 text-white alert-styled-right flex-wrap mb-2">
19-
<span><strong>Your password has been reset.</strong> Please </span>
20-
<a (click)="login()" class="alert-link">sign in</a>.
19+
<span><strong>Your password has been reset.</strong></span>
2120
</p>
22-
<div *ngIf="doNotMatch" class="alert alert-warning alert-styled-right mb-2 flex-wrap">
21+
<div *ngIf="resetAccount.password !== confirmPassword"
22+
class="alert alert-warning alert-styled-right mb-2 flex-wrap">
2323
<span> The password and its confirmation do not match!</span>
2424
</div>
2525
</div>
@@ -72,12 +72,20 @@ <h6 class="font-weight-light text-blue-800">Password reset</h6>
7272
</small>
7373
</div>
7474
</div>
75-
<button [disabled]="passwordForm.form.invalid || sending"
75+
<button [disabled]="passwordForm.form.invalid || sending || doNotMatch"
7676
class="btn btn-block utm-button utm-button-primary"
7777
type="submit">
7878
Reset Password
7979
</button>
8080
</form>
81+
<div class="d-flex flex-column justify-content-center text-center cursor-pointer">
82+
<button [routerLink]="'/'" class="btn btn-link text-muted text-lg"
83+
style="font-size: 0.9rem; text-decoration: none !important;" type="button">
84+
<div class="d-flex align-items-center justify-content-center">
85+
<i class="icon-arrow-left22 ml-2"></i><span
86+
class="txt2"> Back to Login </span></div>
87+
</button>
88+
</div>
8189
</div>
8290
</div>
8391
</div>

frontend/src/app/shared/components/auth/password-reset/finish/password-reset-finish.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {ActivatedRoute, Router} from '@angular/router';
33
import {NgbModalRef} from '@ng-bootstrap/ng-bootstrap';
44
import {ModalService} from '../../../../../core/modal/modal.service';
55
import {PasswordResetFinishService} from './password-reset-finish.service';
6+
import {HttpResponse} from "@angular/common/http";
67

78

89
@Component({
@@ -61,9 +62,10 @@ export class PasswordResetFinishComponent implements OnInit, AfterViewInit {
6162
this.success = 'OK';
6263
this.sending = false;
6364
},
64-
() => {
65+
(error: HttpResponse<any>) => {
66+
this.error = error.headers.get('x-utmstack-error') ||
67+
'An internal error has occurred, please try again.';
6568
this.success = null;
66-
this.error = 'ERROR';
6769
this.sending = false;
6870
}
6971
);

0 commit comments

Comments
 (0)