Skip to content

Commit c0cd47b

Browse files
committed
frontend/user: fix errors found by new tests
1 parent 682096b commit c0cd47b

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

frontend/src/locales/de.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const de ={
1515
"name": "Name",
1616
"change": "Ändern",
1717
"change_password": "Passwort ändern",
18+
"change_password_button": "Passwort ändern",
1819
"current_password": "Aktuelles Passwort",
1920
"current_password_error_message": "Darf nicht leer sein.",
2021
"new_password": "Neues Passwort",
@@ -23,6 +24,7 @@ export const de ={
2324
"confirm_new_password_error_message": "Passwörter stimmen nicht überein",
2425
"close": "Schließen",
2526
"delete_user": "Konto löschen",
27+
"delete_user_button": "Konto löschen",
2628
"password": "Passwort",
2729
"password_invalid": "Passwort falsch",
2830
"logout_all": "Von allen Sessions ausloggen",

frontend/src/locales/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const en = {
1515
"name": "Name",
1616
"change": "Change",
1717
"change_password": "Change password",
18+
"change_password_button": "Change password",
1819
"current_password": "Current password",
1920
"current_password_error_message": "Must not be empty.",
2021
"new_password": "New password",
@@ -23,6 +24,7 @@ export const en = {
2324
"confirm_new_password_error_message": "Passwords do not match",
2425
"close": "Close",
2526
"delete_user": "Delete account",
27+
"delete_user_button": "Delete account",
2628
"password": "Password",
2729
"password_invalid": "Password is wrong",
2830
"logout_all": "Logout from all sessions",

frontend/src/pages/User.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
*/
1919

2020
import { Component } from "preact";
21-
import Form from "react-bootstrap/Form"
22-
import Button from "react-bootstrap/Button";
23-
import Modal from "react-bootstrap/Modal";
21+
import { Form, Button, Modal } from "react-bootstrap";
2422
import { useState } from "preact/hooks";
2523
import { fetchClient, isDebugMode, PASSWORD_PATTERN, concat_salts, generate_hash, generate_random_bytes, get_salt, get_salt_for_user } from "../utils";
2624
import sodium from "libsodium-wrappers";
@@ -288,7 +286,7 @@ export function User() {
288286
id="debugMode"
289287
label={t("debug_mode")}
290288
checked={isDebugMode.value}
291-
onChange={(e) => {
289+
onClick={(e) => {
292290
e.stopPropagation();
293291
const newDebugMode = !isDebugMode.value;
294292
isDebugMode.value = newDebugMode;
@@ -337,15 +335,17 @@ export function User() {
337335
{t("close")}
338336
</Button>
339337
<Button variant="danger" type="submit">
340-
{t("delete_user")}
338+
{t("delete_user_button")}
341339
</Button>
342340
</Modal.Footer>
343341
</Form>
344342
</Modal>
345343

346344
{/* Change password modal */}
347345
<Modal show={showPasswordReset} onHide={handleUpdatePasswordClose} centered>
348-
<Form onSubmit={submitUpdatePassword} validated={validated.value} noValidate>
346+
<Form onSubmit={(e) => {
347+
submitUpdatePassword(e);
348+
}} validated={validated.value} noValidate>
349349
<Modal.Header>
350350
<Modal.Title>
351351
{t("change_password")}
@@ -382,7 +382,7 @@ export function User() {
382382
{t("close")}
383383
</Button>
384384
<Button variant="primary" type="submit">
385-
{t("change_password")}
385+
{t("change_password_button")}
386386
</Button>
387387
</Modal.Footer>
388388
</Form>

0 commit comments

Comments
 (0)