Skip to content

Commit ebc9529

Browse files
fix(Forgot Teacher Password): Blank page
1 parent ef71348 commit ebc9529

3 files changed

Lines changed: 22 additions & 11 deletions

File tree

src/app/forgot/teacher/forgot-teacher-password/forgot-teacher-password.component.spec.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,26 @@ class MockConfigService {
3030
describe('ForgotTeacherPasswordComponent', () => {
3131
beforeEach(waitForAsync(() => {
3232
TestBed.configureTestingModule({
33-
imports: [RecaptchaV3Module, ForgotTeacherPasswordComponent],
33+
imports: [ForgotTeacherPasswordComponent],
3434
providers: [
3535
{ provide: TeacherService, useClass: MockTeacherService },
3636
{ provide: ConfigService, useClass: MockConfigService },
37-
{ provide: RECAPTCHA_V3_SITE_KEY, useValue: '' },
37+
{ provide: RECAPTCHA_V3_SITE_KEY, useValue: '123' },
38+
{
39+
provide: ReCaptchaV3Service,
40+
useValue: {
41+
execute: jasmine.createSpy('execute').and.returnValue(of('mock-token'))
42+
}
43+
},
3844
provideRouter([])
3945
]
40-
});
46+
})
47+
.overrideComponent(ForgotTeacherPasswordComponent, {
48+
remove: {
49+
imports: [RecaptchaV3Module]
50+
}
51+
})
52+
.compileComponents();
4153
}));
4254

4355
beforeEach(() => {
@@ -84,7 +96,6 @@ async function changePassword() {
8496
component.isRecaptchaEnabled = true;
8597
teacherService = TestBed.inject(TeacherService);
8698
const observableResponse = createObservableResponse('failed', 'recaptchaResponseInvalid');
87-
spyOn(recaptchaV3Service, 'execute').and.returnValue(of('token'));
8899
spyOn(teacherService, 'getVerificationCodeEmail').and.returnValue(observableResponse);
89100
await component.submit();
90101
fixture.detectChanges();
@@ -108,7 +119,6 @@ async function changePassword() {
108119
const router = TestBed.inject(Router);
109120
const navigateSpy = spyOn(router, 'navigate');
110121
component.setControlFieldValue('username', 'SpongebobSquarepants');
111-
spyOn(recaptchaV3Service, 'execute').and.returnValue(of('token'));
112122
await component.submit();
113123
fixture.detectChanges();
114124
const params = {

src/app/forgot/teacher/forgot-teacher-password/forgot-teacher-password.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@angular/forms';
1111
import { TeacherService } from '../../../teacher/teacher.service';
1212
import { finalize } from 'rxjs/operators';
13-
import { ReCaptchaV3Service } from 'ng-recaptcha-2';
13+
import { RecaptchaV3Module, ReCaptchaV3Service } from 'ng-recaptcha-2';
1414
import { ConfigService } from '../../../services/config.service';
1515
import { MatDivider } from '@angular/material/divider';
1616
import { MatProgressBar } from '@angular/material/progress-bar';
@@ -32,7 +32,8 @@ import { MatCard, MatCardContent } from '@angular/material/card';
3232
MatError,
3333
MatButton,
3434
MatProgressBar,
35-
MatDivider
35+
MatDivider,
36+
RecaptchaV3Module
3637
],
3738
templateUrl: './forgot-teacher-password.component.html'
3839
})

src/messages.xlf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,7 +3357,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
33573357
</context-group>
33583358
<context-group purpose="location">
33593359
<context context-type="sourcefile">src/app/forgot/teacher/forgot-teacher-password/forgot-teacher-password.component.ts</context>
3360-
<context context-type="linenumber">113</context>
3360+
<context context-type="linenumber">114</context>
33613361
</context-group>
33623362
</trans-unit>
33633363
<trans-unit id="2830770750081682844" datatype="html">
@@ -3436,7 +3436,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
34363436
</context-group>
34373437
<context-group purpose="location">
34383438
<context context-type="sourcefile">src/app/forgot/teacher/forgot-teacher-password/forgot-teacher-password.component.ts</context>
3439-
<context context-type="linenumber">103</context>
3439+
<context context-type="linenumber">104</context>
34403440
</context-group>
34413441
</trans-unit>
34423442
<trans-unit id="6028371114637047813" datatype="html">
@@ -3925,14 +3925,14 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
39253925
<source>You have submitted an invalid verification code too many times. For security reasons, we will lock the ability to change your password for 10 minutes. After 10 minutes, you can try again.</source>
39263926
<context-group purpose="location">
39273927
<context context-type="sourcefile">src/app/forgot/teacher/forgot-teacher-password/forgot-teacher-password.component.ts</context>
3928-
<context context-type="linenumber">107</context>
3928+
<context context-type="linenumber">108</context>
39293929
</context-group>
39303930
</trans-unit>
39313931
<trans-unit id="243316711119938992" datatype="html">
39323932
<source>The server has encountered an error and was unable to send you an email. Please try again. If the error continues to occur, please contact us.</source>
39333933
<context-group purpose="location">
39343934
<context context-type="sourcefile">src/app/forgot/teacher/forgot-teacher-password/forgot-teacher-password.component.ts</context>
3935-
<context context-type="linenumber">110</context>
3935+
<context context-type="linenumber">111</context>
39363936
</context-group>
39373937
</trans-unit>
39383938
<trans-unit id="5039419845796169233" datatype="html">

0 commit comments

Comments
 (0)