Skip to content

Commit c589ed9

Browse files
authored
Merge pull request #2830 from ORCID/lmendoza/PD-5529
PD-5529, PD-5551, PD-5550, PD-5549, PD-5547, PD-5543, PD-3931
2 parents 014a272 + 1ee77e9 commit c589ed9

18 files changed

Lines changed: 190 additions & 135 deletions

SUPPORTED_BROWSERS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
| ---------------- | --------------- |
77
| Android WebView | 145 or newer |
88
| Apple Safari | 17 or newer |
9-
| Google Chrome | 117 or newer |
10-
| Microsoft Edge | 117 or newer |
11-
| Mozilla Firefox | 116 or newer |
12-
| Opera | 103 or newer |
9+
| Google Chrome | 119 or newer |
10+
| Microsoft Edge | 119 or newer |
11+
| Mozilla Firefox | 119 or newer |
12+
| Opera | 105 or newer |
1313
| Opera Mobile | 80 or newer |
14-
| Samsung Internet | 24 or newer |
14+
| Samsung Internet | 25 or newer |

src/app/account-settings/components/settings-security-two-factor-auth/settings-security-two-factor-auth.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
mat-raised-button
3535
color="primary"
3636
id="cy-two-factor-enable"
37+
class="two-factor-panel__enable-button"
3738
(click)="twoFactor()"
3839
i18n="@@account.enableTwoFactorAuth"
3940
>

src/app/account-settings/components/settings-security-two-factor-auth/settings-security-two-factor-auth.component.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
:host {
2+
display: block;
3+
width: 100%;
4+
}
5+
16
.two-factor-panel {
27
display: flex;
38
flex-direction: column;
@@ -78,3 +83,8 @@
7883
border-color: var(--orcid-color-state-warning-dark, #d32f2f) !important;
7984
color: #fff !important;
8085
}
86+
87+
.two-factor-panel__enable-button {
88+
align-self: flex-start;
89+
width: auto;
90+
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"chrome": {
3-
"major": 117,
3+
"major": 119,
44
"minor": 0
55
},
66
"firefox": {
7-
"major": 116,
7+
"major": 119,
88
"minor": 0
99
},
1010
"android": {
1111
"major": 145,
1212
"minor": 0
1313
},
1414
"edge": {
15-
"major": 117,
15+
"major": 119,
1616
"minor": 0
1717
},
1818
"safari": {
@@ -24,11 +24,11 @@
2424
"minor": 0
2525
},
2626
"opera": {
27-
"major": 103,
27+
"major": 105,
2828
"minor": 0
2929
},
3030
"samsung": {
31-
"major": 24,
31+
"major": 25,
3232
"minor": 0
3333
}
3434
}

src/app/cdk/side-bar/modals/modal-websites/modal-websites.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ export class ModalWebsitesComponent implements OnInit, OnDestroy {
152152
websites: [],
153153
visibility: this.originalBackendWebsites.visibility,
154154
}
155-
this._changeDetectorRef.detach()
156155
this.websites.reverse()
157156
this.websites
158157
.map((value) => value.putCode)
@@ -178,15 +177,15 @@ export class ModalWebsitesComponent implements OnInit, OnDestroy {
178177
}
179178

180179
saveEvent() {
181-
if (this.isSavingWebsites) {
180+
if (this.loadingWebsites || this.isSavingWebsites) {
182181
return
183182
}
184183

184+
this.isSavingWebsites = true
185185
this.websitesForm.markAllAsTouched()
186186
this.websitesForm.updateValueAndValidity()
187187

188188
if (this.websitesForm.valid) {
189-
this.isSavingWebsites = true
190189
this._recordWebsitesService
191190
.postWebsites(this.formToBackend(this.websitesForm))
192191
.pipe(
@@ -201,6 +200,7 @@ export class ModalWebsitesComponent implements OnInit, OnDestroy {
201200
() => {}
202201
)
203202
} else {
203+
this.isSavingWebsites = false
204204
this._snackBar.showValidationError()
205205
}
206206
}

src/app/sign-in/components/form-sign-in/form-sign-in.component.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ import { OauthService } from '../../../core/oauth/oauth.service'
1616

1717
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
1818
import { ReactiveFormsModule } from '@angular/forms'
19+
import { Router } from '@angular/router'
1920

2021
describe('FormSignInComponent', () => {
2122
let component: FormSignInComponent
2223
let fixture: ComponentFixture<FormSignInComponent>
24+
let router: Router
2325

2426
beforeEach(() => {
2527
TestBed.configureTestingModule({
@@ -48,10 +50,25 @@ describe('FormSignInComponent', () => {
4850
beforeEach(() => {
4951
fixture = TestBed.createComponent(FormSignInComponent)
5052
component = fixture.componentInstance
53+
router = TestBed.inject(Router)
5154
fixture.detectChanges()
5255
})
5356

5457
it('should create', () => {
5558
expect(component).toBeTruthy()
5659
})
60+
61+
it('only triggers oauth redirect once per successful flow', () => {
62+
component.isOauthAuthorizationTogglzEnable = false
63+
component.platform = { social: false, institutional: false } as any
64+
component.signInLocal = { params: {} } as any
65+
const routerNavigateSpy = spyOn(router, 'navigate').and.returnValue(
66+
Promise.resolve(true)
67+
)
68+
69+
component.oauthAuthorize('https://qa.orcid.org/oauth/authorize')
70+
component.oauthAuthorize('https://qa.orcid.org/oauth/authorize')
71+
72+
expect(routerNavigateSpy).toHaveBeenCalledTimes(1)
73+
})
5774
})

src/app/sign-in/components/form-sign-in/form-sign-in.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class FormSignInComponent implements OnInit, OnDestroy {
8686
backendErrorsMatcher = new ErrorStateMatcherForPasswordField()
8787
emailVerified: boolean
8888
invalidVerifyUrl: boolean
89+
private oauthRedirectTriggered = false
8990

9091
placeholderUsername = $localize`:@@ngOrcid.signin.username:Email or 16-digit ORCID iD`
9192
placeholderPassword = $localize`:@@ngOrcid.signin.yourOrcidPassword:Your ORCID password`
@@ -386,9 +387,15 @@ export class FormSignInComponent implements OnInit, OnDestroy {
386387
}
387388

388389
oauthAuthorize(urlRedirect) {
390+
if (this.oauthRedirectTriggered) {
391+
return
392+
}
393+
this.oauthRedirectTriggered = true
394+
389395
if (this.isOauthAuthorizationTogglzEnable) {
390-
if (this._oauthUrlSessionManager.get()) {
391-
urlRedirect = this._oauthUrlSessionManager.get()
396+
const storedOauthRedirectUrl = this._oauthUrlSessionManager.get()
397+
if (storedOauthRedirectUrl) {
398+
urlRedirect = storedOauthRedirectUrl
392399
this._oauthUrlSessionManager.clear()
393400
}
394401
//add http if not present

src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@
4848
type="button"
4949
class="textarea-copy-action"
5050
[cdkCopyToClipboard]="textCodeClipboard"
51-
matTooltip="{{ textCodeCopiedTooltip }}"
52-
#textCodeTooltip="matTooltip"
53-
(click)="textCodeTooltip.toggle()"
51+
matTooltip="{{ textCodeTooltip }}"
5452
i18n-aria-label="@@account.copySetupCode"
5553
aria-label="Copy setup code"
5654
>
@@ -86,7 +84,7 @@
8684
i18n="@@ngOrcid.signin.2fa.verificationCodeRequired"
8785
class="error-message"
8886
>
89-
Authentication code is required
87+
A verification code is required
9088
</p>
9189
<p class="error-length">
9290
{{ inputVerificationCode.value?.length || 0 }}/6
@@ -103,7 +101,7 @@
103101
i18n="@@ngOrcid.signin.2fa.badVerificationCodeLength"
104102
class="error-message"
105103
>
106-
Invalid authentication code length
104+
Invalid verification code length
107105
</p>
108106
<p class="error-length">
109107
{{ inputVerificationCode.value?.length || 0 }}/6
@@ -117,7 +115,7 @@
117115
i18n="@@ngOrcid.signin.2fa.badVerificationCode"
118116
class="error-message"
119117
>
120-
Invalid authentication code
118+
Invalid verification code
121119
</p>
122120
<p class="error-length">
123121
{{ inputVerificationCode.value?.length || 0 }}/6

src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ textarea.text-code {
2727
}
2828

2929
mat-error {
30+
display: block;
31+
margin-top: var(--orcid-space-s, 8px);
32+
3033
p {
3134
margin: 0 !important;
3235
}

src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe('TwoFactorEnableComponent', () => {
118118
})
119119

120120
it('should call register method when input is filled and submit is triggered', async () => {
121-
component.twoFactorForm.get('verificationCode').setValue('123456')
121+
component.twoFactorForm.get('verificationCode')?.setValue('123456')
122122

123123
fixture.detectChanges()
124124
await fixture.whenStable()
@@ -132,4 +132,8 @@ describe('TwoFactorEnableComponent', () => {
132132
component.twoFactorForm.get('verificationCode')?.hasError('invalidCode')
133133
).toBeFalse()
134134
})
135+
136+
it('should expose static setup code tooltip text', () => {
137+
expect(component.textCodeTooltip).toBe('Copy setup code to clipboard')
138+
})
135139
})

0 commit comments

Comments
 (0)