Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
consolidated language
  • Loading branch information
Kira-Pilot committed Dec 1, 2023
commit ecdb59e0cb9f7f214c434983ed2e35719faa21cf
2 changes: 1 addition & 1 deletion coderd/httpmw/apikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func RedirectToLogin(rw http.ResponseWriter, r *http.Request, dashboardURL *url.
}

q := url.Values{}
q.Add("info", message)
q.Add("message", message)
q.Add("redirect", path)

u := &url.URL{
Expand Down
5 changes: 3 additions & 2 deletions site/src/pages/LoginPage/LoginPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export const LoginPageView: FC<LoginPageViewProps> = ({
const redirectTo = retrieveRedirect(location.search);
// This allows messages to be displayed at the top of the sign in form.
// Helpful for any redirects that want to inform the user of something.
const info = new URLSearchParams(location.search).get("info") || undefined;
const message =
new URLSearchParams(location.search).get("message") || undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...then you wouldn't need this || undefined!

const applicationName = getApplicationName();
const logoURL = getLogoURL();
const applicationLogo = logoURL ? (
Expand Down Expand Up @@ -52,7 +53,7 @@ export const LoginPageView: FC<LoginPageViewProps> = ({
redirectTo={redirectTo}
isSigningIn={isSigningIn}
error={error}
info={info}
message={message}
onSubmit={onSignIn}
/>
<footer css={styles.footer}>
Expand Down
8 changes: 4 additions & 4 deletions site/src/pages/LoginPage/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface SignInFormProps {
isSigningIn: boolean;
redirectTo: string;
error?: unknown;
info?: string;
message?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this was message?: ReactNode;...

authMethods?: AuthMethods;
onSubmit: (credentials: { email: string; password: string }) => void;
}
Expand All @@ -73,7 +73,7 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
redirectTo,
isSigningIn,
error,
info,
message,
onSubmit,
}) => {
const oAuthEnabled = Boolean(
Expand All @@ -91,9 +91,9 @@ export const SignInForm: FC<React.PropsWithChildren<SignInFormProps>> = ({
</div>
)}

{Boolean(info) && (
{Boolean(message) && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Boolean(message) && (
{message && (

nit: technically this cast is superfluous

<div css={styles.alert}>
<Alert severity="info">{info}</Alert>
<Alert severity="info">{message}</Alert>
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useSingleSignOnSection = () => {
// The redirect on success should be back to the login page with a nice message.
// The user should be logged out if this worked.
encodeURIComponent(
`/login?info=Login type has been changed to ${loginTypeMsg}. Log in again using the new method.`,
`/login?message=Login type has been changed to ${loginTypeMsg}. Log in again using the new method.`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this'll evaluate to "%2Flogin%3Fmessage%3DLogin%20type%20...", which I'm guessing is what we want but this diff doesn't give much context. if it was fine before though it's probably ok!

),
);
},
Expand Down