Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SF-3117 Add logo option to remove branding on auth0 page #2937

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
});
env.localSettings.clear();
expect(env.service.currentUserRoles.length).toBe(0);
env.localSettings.set(ROLE_SETTING, SystemRole.SystemAdmin);

Check warning on line 196 in src/SIL.XForge.Scripture/ClientApp/src/xforge-common/auth.service.spec.ts

View workflow job for this annotation

GitHub Actions / Lint and Prettier (22.13.0, 10.9.2)

'ROLE_SETTING' is deprecated. This value is deprecated, but maintained to ensure compatibility with older login sessions
expect(env.service.currentUserRoles.length).toBe(1);
env.discardTokenExpiryTimer();
}));
Expand Down Expand Up @@ -416,6 +416,22 @@
}
}));

it('should login with defined logo', fakeAsync(() => {
const env = new TestEnvironment();
when(mockedLocationService.origin).thenReturn('https://scriptureforge.org');

env.service.logIn({ returnUrl: 'test-returnUrl' });

verify(mockedWebAuth.loginWithRedirect(anything())).once();
const authOptions: RedirectLoginOptions | undefined = capture<RedirectLoginOptions | undefined>(
mockedWebAuth.loginWithRedirect
).last()[0];
expect(authOptions).toBeDefined();
if (authOptions != null) {
expect(authOptions.authorizationParams!.logo).toBeDefined();
}
}));

it('should link with Paratext', fakeAsync(() => {
const env = new TestEnvironment({ isOnline: true, isLoggedIn: true });
const returnUrl = 'test-returnUrl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

interface xForgeAuth0Parameters extends AuthorizationParams {
mode?: string;
logo?: string;
login_hint?: string;
language?: string;
enablePasswordless?: boolean;
Expand Down Expand Up @@ -145,7 +146,7 @@

get currentUserRoles(): SystemRole[] {
// Provide compatibility with login session predating role array support
const role = this.localSettings.get<SystemRole | undefined>(ROLE_SETTING);

Check warning on line 149 in src/SIL.XForge.Scripture/ClientApp/src/xforge-common/auth.service.ts

View workflow job for this annotation

GitHub Actions / Lint and Prettier (22.13.0, 10.9.2)

'ROLE_SETTING' is deprecated. This value is deprecated, but maintained to ensure compatibility with older login sessions
if (role != null) {
return [role];
} else {
Expand Down Expand Up @@ -247,7 +248,8 @@
ui_locales: language,
enablePasswordless: true,
language,
login_hint: ui_locales
login_hint: ui_locales,
logo: 'https://auth0.languagetechnology.org/assets/sf.svg'
};

if (signUp || this.isJoining) {
Expand Down Expand Up @@ -676,7 +678,7 @@
this.localSettings.set(ID_TOKEN_SETTING, idToken);
this.localSettings.set(EXPIRES_AT_SETTING, expiresAt);
this.localSettings.set(USER_ID_SETTING, userId);
this.localSettings.remove(ROLE_SETTING);

Check warning on line 681 in src/SIL.XForge.Scripture/ClientApp/src/xforge-common/auth.service.ts

View workflow job for this annotation

GitHub Actions / Lint and Prettier (22.13.0, 10.9.2)

'ROLE_SETTING' is deprecated. This value is deprecated, but maintained to ensure compatibility with older login sessions
this.localSettings.set(ROLES_SETTING, typeof role === 'string' ? [role] : role || []);
this.scheduleRenewal();
this.bugsnagService.leaveBreadcrumb(
Expand All @@ -695,7 +697,7 @@
this.localSettings.remove(ID_TOKEN_SETTING);
this.localSettings.remove(EXPIRES_AT_SETTING);
this.localSettings.remove(USER_ID_SETTING);
this.localSettings.remove(ROLE_SETTING);

Check warning on line 700 in src/SIL.XForge.Scripture/ClientApp/src/xforge-common/auth.service.ts

View workflow job for this annotation

GitHub Actions / Lint and Prettier (22.13.0, 10.9.2)

'ROLE_SETTING' is deprecated. This value is deprecated, but maintained to ensure compatibility with older login sessions
this.localSettings.remove(ROLES_SETTING);
}
}
Loading