Implement hashed password transfer, change password, redesign the settings UI

This commit is contained in:
2025-10-30 22:36:23 +03:00
Unverified
parent 1d4a46dff2
commit 5f49b45eed
13 changed files with 381 additions and 74 deletions
+3 -2
View File
@@ -2,7 +2,7 @@ import { useImmer } from "use-immer";
import { AlertsContainer, type Alert, type AlertType } from "./Auth";
import { AuthContainer, AuthHeader } from "./Auth";
import type { ErrorResponse, LoginRequest, LoginResponse } from "@/core/types";
import { ensureKeysOnLogin } from "@/core/api/authApi";
import { ensureKeysOnLogin, deriveAuthSecret } from "@/core/api/authApi";
import { API_BASE_URL } from "@/core/config";
import { useRef } from "react";
import type { TextField } from "mdui/components/text-field";
@@ -47,9 +47,10 @@ export default function LoginPage() {
}
try {
const derived = await deriveAuthSecret(username, password);
const request: LoginRequest = {
username: username,
password: password
password: derived
}
const response = await fetch(`${API_BASE_URL}/login`, {
+4 -3
View File
@@ -7,7 +7,7 @@ import type { ErrorResponse, RegisterRequest, LoginResponse } from "@/core/types
import { API_BASE_URL } from "@/core/config";
import { useAppState } from "@/pages/chat/state";
import { MaterialTextField } from "@/core/components/MaterialTextField";
import { ensureKeysOnLogin } from "@/core/api/authApi";
import { ensureKeysOnLogin, deriveAuthSecret } from "@/core/api/authApi";
import { useNavigate } from "react-router-dom";
import "./auth.scss";
import useDownloadAppScreen from "@/core/hooks/useDownloadAppScreen";
@@ -74,11 +74,12 @@ export default function RegisterPage() {
}
try {
const derived = await deriveAuthSecret(username, password);
const request: RegisterRequest = {
display_name: displayName,
username: username,
password: password,
confirm_password: confirmPassword
password: derived,
confirm_password: derived
}
const response = await fetch(`${API_BASE_URL}/register`, {