Skip to content
Open
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
2 changes: 2 additions & 0 deletions public/locales/de-DE/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,11 @@
"new-password": "Neues Passwort",
"new-password-repeat": "Neues Passwort (wiederholen)",
"change-password": "Passwort ändern",
"unlock": "Benutzer entsperren",
"success-created": "Neuer Benutzer erfolgreich erstellt.",
"success-updated": "Profil aktualisiert.",
"password-success": "Passwort geändert.",
"unlock-success": "Benutzer entsperrt.",
"password-mismatch": "Die Passwörter stimmen nicht überein.",
"remove-from-group": "Aus Gruppe entfernen",
"confirm-remove-from-group": "Möchten Sie den Benutzer wirklich aus dieser Gruppe entfernen?",
Expand Down
2 changes: 2 additions & 0 deletions public/locales/en-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,11 @@
"new-password": "New Password",
"new-password-repeat": "New Password (repeat)",
"change-password": "Change Password",
"unlock": "Unlock User",
"success-created": "Successfully created new user.",
"success-updated": "Profile updated.",
"password-success": "Password changed.",
"unlock-success": "User unlocked.",
"password-mismatch": "Passwords do not match.",
"remove-from-group": "Remove from group",
"confirm-remove-from-group": "Do you really want to remove the user from this group?",
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Admin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ const UserProfile = ({ user_id }) => {
const UserPassword = ({ user_id }) => {
const
state = useContext(AppState),
{ api: { user: { credentials } } } = state,
{ api: { user: { credentials, unlock } } } = state,
[t] = useTranslation(),
password = useSignal(''),
password_repeat = useSignal(''),
Expand All @@ -730,6 +730,7 @@ const UserPassword = ({ user_id }) => {
return <>
<h3>{t("admin.user.password")}</h3>
<ActionResult signal={credentials} success={t("admin.user.password-success")} />
<ActionResult signal={unlock} success={t("admin.user.unlock-success")} />
{mismatch.value ? <p class="error">{t("admin.user.password-mismatch")}</p> : null}
<form onSubmit={on_submit}>
<label for="new-password">{t("admin.user.new-password")}</label>
Expand All @@ -742,6 +743,7 @@ const UserPassword = ({ user_id }) => {

<div class="button-group">
<button type="submit">{t("admin.user.change-password")}</button>
<button type="button" class="secondary" onClick={() => engine_rest.user.unlock(state, user_id)}>{t("admin.user.unlock")}</button>
</div>
</form>
</>
Expand Down
11 changes: 11 additions & 0 deletions src/pages/Admin.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ describe("AdminPage", () => {
expect(engine_rest.user.delete.mock.lastCall[0]).toBe(state);
expect(engine_rest.user.delete.mock.lastCall[1]).toBe("jdoe");
});

it("unlocks the user from the password section", () => {
mockParams = { page_id: "users", selection_id: "jdoe" };
const { getByText } = renderPage(state);

fireEvent.click(getByText("admin.user.unlock"));

expect(engine_rest.user.unlock).toHaveBeenCalled();
expect(engine_rest.user.unlock.mock.lastCall[0]).toBe(state);
expect(engine_rest.user.unlock.mock.lastCall[1]).toBe("jdoe");
});
});

describe("Groups", () => {
Expand Down