Skip to content

Commit

Permalink
Show email when available in the create credentials confirmation modal (
Browse files Browse the repository at this point in the history
  • Loading branch information
eladlachmi authored Feb 12, 2024
1 parent 278bf4a commit d14ae26
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions webui/src/pages/auth/credentials.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ import {useState} from "react";
import {CredentialsShowModal, CredentialsTable} from "../../lib/components/auth/credentials";
import {useRouter} from "../../lib/hooks/router";

const resolveDisplayName = (user) => {
if (!user) return "";
if (user?.email?.length) return user.email;
return user.id;
}

const CredentialsContainer = () => {
const router = useRouter();
const { user } = useUser();
const userId = (user) ? user.id : "";
const [refreshToken, setRefreshToken] = useState(false);
const [createError, setCreateError] = useState(null);
const [createdKey, setCreatedKey] = useState(null);
Expand All @@ -41,7 +45,7 @@ const CredentialsContainer = () => {
<ConfirmationButton
variant="success"
modalVariant="success"
msg={<span>Create a new Access Key for user <strong>{userId}</strong>?</span>}
msg={<span>Create a new Access Key for user <strong>{resolveDisplayName(user)}</strong>?</span>}
onConfirm={hide => {
createKey()
.then(key => { setCreatedKey(key) })
Expand Down

0 comments on commit d14ae26

Please sign in to comment.