Skip to content

Commit 06c0e13

Browse files
committed
fix(members): simplify email change sign-in banner
1 parent a86e642 commit 06c0e13

5 files changed

Lines changed: 16 additions & 15 deletions

File tree

members/src/app/auth-actions/auth-actions.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ describe('AuthActions - Unit Tests', () => {
7171
expect(syncAuthEmailToMember).not.toHaveBeenCalled();
7272
expect(navigateSpy).toHaveBeenCalledWith(['/sign-in'], {
7373
queryParams: {
74-
emailChanged: 'true',
75-
message: 'Your email was updated. Please sign in again with your new email.',
74+
message: 'email-changed',
7675
},
7776
});
7877
});
@@ -93,8 +92,7 @@ describe('AuthActions - Unit Tests', () => {
9392
expect(syncAuthEmailToMember).not.toHaveBeenCalled();
9493
expect(navigateSpy).toHaveBeenCalledWith(['/sign-in'], {
9594
queryParams: {
96-
emailChanged: 'true',
97-
message: 'Your email was updated. Please sign in again with your new email.',
95+
message: 'email-changed',
9896
},
9997
});
10098
});
@@ -125,8 +123,7 @@ describe('AuthActions - Unit Tests', () => {
125123
expect(syncAuthEmailToMember).not.toHaveBeenCalled();
126124
expect(navigateSpy).toHaveBeenCalledWith(['/sign-in'], {
127125
queryParams: {
128-
emailChanged: 'true',
129-
message: 'Your email was updated. Please sign in again with your new email.',
126+
message: 'email-changed',
130127
},
131128
});
132129
});

members/src/app/auth-actions/auth-actions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ export class AuthActions {
8989
if (shouldSyncMemberEmail) {
9090
await this.router.navigate(['/sign-in'], {
9191
queryParams: {
92-
emailChanged: 'true',
93-
message: 'Your email was updated. Please sign in again with your new email.',
92+
message: 'email-changed',
9493
},
9594
});
9695
this.processingState.set('success');

members/src/app/sign-in/sign-in.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ <h1>Welcome Back</h1>
1515
</div>
1616
}
1717

18+
@if (message() === 'email-changed') {
19+
<div class="form__info-message">
20+
Your email was updated. Please sign in again with your new email.
21+
</div>
22+
}
23+
1824
@if (errorMessage(); as error) {
1925
<div class="form__error-message">
2026
{{ error }}

members/src/app/sign-in/sign-in.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('SignIn', () => {
123123

124124
it('should sync member email after sign-in when redirected from email change flow', async () => {
125125
const { user, syncAuthEmailToMember } = await setup({
126-
emailChanged: 'true',
126+
message: 'email-changed',
127127
});
128128

129129
await user.type(screen.getByLabelText('Email Address'), 'test@example.com');
@@ -137,7 +137,7 @@ describe('SignIn', () => {
137137

138138
it('should show sync errors after sign-in when email recovery sync fails', async () => {
139139
const { user } = await setup({
140-
emailChanged: 'true',
140+
message: 'email-changed',
141141
syncEmailError: new Error('You must be signed in to update your email.'),
142142
});
143143

@@ -153,15 +153,15 @@ interface SetupOptions {
153153
signInError?: Error;
154154
signInDelay?: number;
155155
signInImplementation?: () => Promise<void>;
156-
emailChanged?: string;
156+
message?: string;
157157
syncEmailError?: Error;
158158
}
159159

160160
async function setup({
161161
signInError,
162162
signInDelay,
163163
signInImplementation,
164-
emailChanged,
164+
message,
165165
syncEmailError,
166166
}: SetupOptions = {}) {
167167
const mockAuthService = {
@@ -196,7 +196,7 @@ async function setup({
196196
},
197197
provideRouter([]),
198198
],
199-
bindings: [inputBinding('emailChanged', () => emailChanged)],
199+
bindings: [inputBinding('message', () => message)],
200200
});
201201

202202
const user = userEvent.setup();

members/src/app/sign-in/sign-in.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export class SignIn {
1717
private fb = inject(FormBuilder);
1818

1919
message = input<string>();
20-
emailChanged = input<string>();
2120

2221
signInForm: FormGroup = this.fb.group({
2322
email: ['', [Validators.required.bind(this), Validators.email.bind(this)]],
@@ -37,7 +36,7 @@ export class SignIn {
3736

3837
await this.authService.signInWithEmail(email, password);
3938

40-
if (this.emailChanged() === 'true') {
39+
if (this.message() === 'email-changed') {
4140
await this.membershipService.syncAuthEmailToMember();
4241
}
4342

0 commit comments

Comments
 (0)