Skip to content

Commit

Permalink
Don't say 'all' if it's qualified with 'other'. (#882)
Browse files Browse the repository at this point in the history
* Don't say 'all' if it's qualified with 'other'.

* not sure where this one appears?

* Lint

* Lint

* yarn fmt

* Add link (from Eric)
  • Loading branch information
UserNotFound authored Jul 15, 2024
1 parent 9910197 commit 49366b7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ export const revokeAllTokens = authApi.post(
return;
}
tunaEvent("revoked-all-tokens");
ctx.loader = { message: "Successfully logged out all other sessions!" };
ctx.loader = {
message:
"Successfully logged out of other sessions! You may wish to log out of this session, as well.",
};
},
);

Expand All @@ -180,5 +183,5 @@ export function* revokeTokensMdw(ctx: AuthApiCtx, next: Next) {

yield* revokeAllTokens.run();
const msg = ctx.loader?.message || "Success!";
ctx.loader = { message: `${msg} All other sessions have been logged out.` };
ctx.loader = { message: `${msg} Other sessions have been logged out.` };
}
2 changes: 1 addition & 1 deletion src/ui/pages/logout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const LogoutPage = () => {
<p className="my-6 text-gray-600">
Click to log out now or visit{" "}
<Link to={securitySettingsUrl()}>Security Settings</Link> to log out
of all active sessions.
of other active sessions, first.
</p>
</div>
<Box>
Expand Down
24 changes: 20 additions & 4 deletions src/ui/pages/settings-security.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ import {
} from "@app/react";
import {
addSecurityKeyUrl,
logoutUrl,
otpRecoveryCodesUrl,
otpSetupUrl,
} from "@app/routes";
import { schema } from "@app/schema";
import { selectCurrentUserId, updateEmail } from "@app/users";
import { emailValidator } from "@app/validator";
import { useState } from "react";
import { Link } from "react-router-dom";
import { useCurrentUser } from "../hooks";
import {
Banner,
Expand Down Expand Up @@ -361,16 +363,30 @@ const LogOut = () => {

return (
<Group>
<BannerMessages {...loader} />
{loader.isSuccess ? (
<BannerMessages
{...loader}
message={
<>
<span>{loader.message} </span>
<Link to={logoutUrl()} className={tokens.type["white link"]}>
Logout
</Link>
</>
}
/>
) : (
<BannerMessages {...loader} />
)}

<div>
This action will log out all <strong>other</strong> sessions and cannot
be undone.
be undone. This session will remain logged in.
</div>

<div>
<Button variant="delete" requireConfirm onClick={confirmLogout}>
Log out all sessions
Log out other sessions
</Button>
</div>
</Group>
Expand All @@ -396,7 +412,7 @@ export const SecuritySettingsPage = () => {
<Section title="Security Keys">
<SecurityKeys />
</Section>
<Section title="Log out all sessions">
<Section title="Log out other sessions">
<LogOut />
</Section>
</BoxGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/shared/banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const BannerMessages = ({
isSuccess: boolean;
isError: boolean;
isWarning?: boolean;
message: string;
message: React.ReactNode;
className?: string;
}) => {
if (!message) return null;
Expand Down
1 change: 1 addition & 0 deletions src/ui/shared/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const tokens = {

link: "font-medium text-sm text-gray-500 hover:text-indigo",
"table link": "text-black group-hover:text-indigo hover:text-indigo",
"white link": "text-white underline",

"active link": "font-medium text-sm text-gray-700",
"subdued active link": "font-medium text-sm text-amber-600",
Expand Down

0 comments on commit 49366b7

Please sign in to comment.