refactor: Update login page SSO message for clarity and consistency

This commit is contained in:
Simon Larsen 2024-05-04 21:51:09 +01:00
parent 5541922b25
commit 8761dbd75b
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
4 changed files with 30 additions and 24 deletions

View File

@ -138,7 +138,9 @@ const LoginPage: () => JSX.Element = () => {
{showSsoTip && (
<div className="text-gray-500 text-sm">
Please sign in with your SSO provider like Okta, Auth0, Entra ID or any other SAML 2.0 provider.
Please sign in with your SSO
provider like Okta, Auth0, Entra ID
or any other SAML 2.0 provider.
</div>
)}
</div>

View File

@ -123,7 +123,6 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
res: ExpressResponse
): Promise<void> => {
try {
debugger;
const samlResponseBase64: string = req.body.SAMLResponse;
@ -383,7 +382,6 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
new PositiveNumber(30)
),
});
const oneUptimeToken: string = JSONWebToken.signUserLoginToken({
tokenData: {
@ -399,17 +397,29 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
});
// Set a cookie with token.
CookieUtil.setCookie(res, CookieUtil.getUserTokenKey(), oneUptimeToken, {
maxAge: OneUptimeDate.getMillisecondsInDays(
new PositiveNumber(30)
),
httpOnly: true,
});
CookieUtil.setCookie(
res,
CookieUtil.getUserTokenKey(),
oneUptimeToken,
{
maxAge: OneUptimeDate.getMillisecondsInDays(
new PositiveNumber(30)
),
httpOnly: true,
}
);
CookieUtil.setCookie(res, CookieUtil.getUserSSOKey(projectId), ssoToken, {
maxAge: OneUptimeDate.getMillisecondsInDays(new PositiveNumber(30)),
httpOnly: true,
});
CookieUtil.setCookie(
res,
CookieUtil.getUserSSOKey(projectId),
ssoToken,
{
maxAge: OneUptimeDate.getMillisecondsInDays(
new PositiveNumber(30)
),
httpOnly: true,
}
);
// Refresh Permissions for this user here.
await AccessTokenService.refreshUserAllPermissions(
@ -419,7 +429,6 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
const host: Hostname = await DatabaseConfig.getHost();
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
return Response.redirect(
req,
res,
@ -428,10 +437,9 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
host,
new Route(DashboardRoute.toString()).addRoute(
'/' + req.params['projectId']
),
)
)
);
} catch (err) {
logger.error(err);
Response.sendErrorResponse(req, res, new ServerException());

View File

@ -19,10 +19,7 @@ import Navigation from 'CommonUI/src/Utils/Navigation';
import RouteMap from './Utils/RouteMap';
import PageMap from './Utils/PageMap';
import {
BILLING_ENABLED,
APP_API_URL,
} from 'CommonUI/src/Config';
import { BILLING_ENABLED, APP_API_URL } from 'CommonUI/src/Config';
import ActiveIncidents from './Pages/Global/NewIncidents';
import ProjectInvitations from './Pages/Global/ProjectInvitations';
@ -262,7 +259,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.HOME_NOT_OPERATIONAL_MONITORS
PageMap.HOME_NOT_OPERATIONAL_MONITORS
] as Route
}
/>
@ -282,8 +279,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
PageMap
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
] as Route
}
/>

View File

@ -16,7 +16,6 @@ export interface ComponentProps extends PageComponentProps {
const Init: FunctionComponent<ComponentProps> = (
props: ComponentProps
): ReactElement => {
useEffect(() => {
// set slug to latest project and redirect to home.