-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
2,722 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export interface IKeyValidationResult { | ||
expiredKey: boolean | ||
invalidKey: boolean | ||
} | ||
|
||
export class KeyValidationResult implements IKeyValidationResult { | ||
expiredKey: boolean | ||
invalidKey: boolean | ||
|
||
constructor(expiredKey: boolean, invalidKey: boolean) { | ||
this.expiredKey = expiredKey | ||
this.invalidKey = invalidKey | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
ui/src/app/account/model/resend-activation-email-result.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface IResendActivationEmailResult { | ||
resent: boolean | ||
} | ||
|
||
export class ResendActivationEmailResult implements IResendActivationEmailResult { | ||
resent: boolean | ||
|
||
constructor(resent: boolean) { | ||
this.resent = resent | ||
} | ||
} |
166 changes: 166 additions & 0 deletions
166
ui/src/app/account/password/password-reset-finish.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h1 i18n="@@reset.finish.title.string">Reset password</h1> | ||
|
||
<div class="alert alert-danger" i18n="@@reset.finish.messages.keymissing.string" *ngIf="keyMissing"> | ||
<strong>The activation key is missing.</strong> | ||
</div> | ||
|
||
<div class="alert alert-danger" i18n="@@reset.finish.messages.keyinvalid.string" *ngIf="invalidKey"> | ||
<strong>This activation key is invalid.</strong> | ||
</div> | ||
|
||
<div class="alert alert-danger" i18n="@@reset.finish.messages.keyexpired.string" *ngIf="expiredKey"> | ||
<strong>This activation has expired.</strong> | ||
</div> | ||
<div *ngIf="expiredKey"> | ||
<p> | ||
<span i18n="@@reset.finish.messages.keyexpired.paragraph1.string" | ||
>ORCID Member Portal activation links are only valid for 24 hours. It looks like this link has | ||
expired.</span | ||
> | ||
</p> | ||
<p> | ||
<span *ngIf="activationEmailResent" i18n="@@reset.finish.messages.keyexpired.paragraph2.string" | ||
>To make sure you can activate your Member Portal account we have sent a new activation link to your | ||
registered email address.</span | ||
> | ||
</p> | ||
<p> | ||
<span *ngIf="activationEmailResent" i18n="@@reset.finish.messages.keyexpired.paragraph3.string" | ||
>If you are still having problems activating your account or have not received your new activation link | ||
please contact our support team please contact us at membership@orcid.org.</span | ||
> | ||
</p> | ||
</div> | ||
|
||
<div class="alert alert-warning" *ngIf="!success && !keyMissing && !expiredKey && !invalidKey"> | ||
<p i18n="@@reset.finish.messages.info.string">Choose a new password</p> | ||
</div> | ||
|
||
<div class="alert alert-danger" *ngIf="error"> | ||
<p i18n="@@reset.finish.messages.error.string"> | ||
Your password couldn't be reset. Remember a password request is only valid for 24 hours. | ||
</p> | ||
</div> | ||
|
||
<p class="alert alert-success" *ngIf="success"> | ||
<span i18n="@@reset.finish.messages.success.string" | ||
><strong>Your password has been reset.</strong> Please | ||
</span> | ||
<a | ||
class="alert-link" | ||
tabindex="0" | ||
(click)="navigateToLoginPage()" | ||
(keydown.enter)="navigateToLoginPage()" | ||
i18n="@@global.messages.info.authenticated.link.string" | ||
>sign in</a | ||
>. | ||
</p> | ||
|
||
<div class="alert alert-danger" *ngIf="doNotMatch" i18n="@@global.messages.error.dontmatch.string"> | ||
The password and its confirmation do not match! | ||
</div> | ||
|
||
<div *ngIf="!keyMissing && showPasswordForm"> | ||
<form *ngIf="!success" name="form" role="form" (ngSubmit)="finishReset()" [formGroup]="passwordForm"> | ||
<div class="form-group"> | ||
<label class="form-control-label" for="password" i18n="@@global.form.newpassword.label.string" | ||
>New password</label | ||
> | ||
<input | ||
type="password" | ||
class="form-control" | ||
id="password" | ||
name="password" | ||
placeholder="New password" | ||
i18n-placeholder="@@global.form.newpassword.placeholder.string" | ||
formControlName="newPassword" | ||
/> | ||
<div | ||
*ngIf=" | ||
passwordForm.get('newPassword')?.['invalid'] && | ||
(passwordForm.get('newPassword')?.['dirty'] || passwordForm.get('newPassword')?.['touched']) | ||
" | ||
> | ||
<small | ||
class="form-text text-danger" | ||
*ngIf="(passwordForm.get('newPassword')?.errors)!['required']" | ||
i18n="@@global.messages.validate.newpassword.required.string" | ||
> | ||
Your password is required. | ||
</small> | ||
<small | ||
class="form-text text-danger" | ||
*ngIf="(passwordForm.get('newPassword')?.errors)!['minlength']" | ||
i18n="@@global.messages.validate.newpassword.minlength.string" | ||
> | ||
Your password is required to be at least 4 characters. | ||
</small> | ||
<small | ||
class="form-text text-danger" | ||
*ngIf="(passwordForm.get('newPassword')?.errors)!['maxlength']" | ||
i18n="@@global.messages.validate.newpassword.maxlength.string" | ||
> | ||
Your password cannot be longer than 50 characters. | ||
</small> | ||
</div> | ||
<app-password-strength [passwordToCheck]="passwordForm.get('newPassword')?.value"></app-password-strength> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label class="form-control-label" for="confirmPassword" i18n="@@global.form.confirmpassword.label.string" | ||
>New password confirmation</label | ||
> | ||
<input | ||
type="password" | ||
class="form-control" | ||
id="confirmPassword" | ||
name="confirmPassword" | ||
placeholder="Confirm the new password" | ||
i18n-placeholder="@@global.form.confirmpassword.placeholder.string" | ||
formControlName="confirmPassword" | ||
/> | ||
<div | ||
*ngIf=" | ||
passwordForm.get('confirmPassword')?.['invalid'] && | ||
(passwordForm.get('confirmPassword')?.['dirty'] || passwordForm.get('confirmPassword')?.['touched']) | ||
" | ||
> | ||
<small | ||
class="form-text text-danger" | ||
*ngIf="(passwordForm.get('confirmPassword')?.errors)!['required']" | ||
i18n="@@global.messages.validate.confirmpassword.required.string" | ||
> | ||
Your password confirmation is required. | ||
</small> | ||
<small | ||
class="form-text text-danger" | ||
*ngIf="(passwordForm.get('confirmPassword')?.errors)!['minlength']" | ||
i18n="@@global.messages.validate.confirmpassword.minlength.string" | ||
> | ||
Your password confirmation is required to be at least 4 characters. | ||
</small> | ||
<small | ||
class="form-text text-danger" | ||
*ngIf="(passwordForm.get('confirmPassword')?.errors)!['maxlength']" | ||
i18n="@@global.messages.validate.confirmpassword.maxlength.string" | ||
> | ||
Your password confirmation cannot be longer than 50 characters. | ||
</small> | ||
</div> | ||
</div> | ||
<button | ||
type="submit" | ||
[disabled]="passwordForm.invalid" | ||
class="btn btn-primary" | ||
i18n="@@reset.finish.form.button.string" | ||
> | ||
Reset Password | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
40 changes: 40 additions & 0 deletions
40
ui/src/app/account/password/password-reset-finish.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PasswordResetFinishComponent } from './password-reset-finish.component'; | ||
import { AppModule } from 'src/app/app.module'; | ||
import { PasswordService } from '../service/password.service'; | ||
import { of, throwError } from 'rxjs'; | ||
|
||
describe('PasswordResetFinishComponent', () => { | ||
let component: PasswordResetFinishComponent; | ||
let fixture: ComponentFixture<PasswordResetFinishComponent>; | ||
let service: PasswordService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [AppModule], | ||
declarations: [PasswordResetFinishComponent] | ||
}); | ||
fixture = TestBed.createComponent(PasswordResetFinishComponent); | ||
service = fixture.debugElement.injector.get(PasswordService) | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('password should save successfully', () => { | ||
spyOn(service, 'savePassword').and.returnValue(of(true)) | ||
component.finishReset(); | ||
expect(component.success).toEqual('OK') | ||
}); | ||
|
||
it('password save should fail', () => { | ||
spyOn(service, 'savePassword').and.returnValue(throwError(() => new Error('error'))) | ||
component.finishReset(); | ||
expect(component.error).toEqual('ERROR') | ||
expect(component.success).toBeFalsy(); | ||
}); | ||
}); |
Oops, something went wrong.