feat: implement password reset functionality with token verification and change password feature

This commit is contained in:
2025-10-10 09:15:29 +02:00
parent 7ec4bdf620
commit f1e7c2d7aa
9 changed files with 441 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ export const AUDIT_ACTIONS = {
LOGIN: "login",
LOGOUT: "logout",
LOGIN_FAILED: "login_failed",
PASSWORD_RESET_REQUEST: "password_reset_request",
PASSWORD_RESET: "password_reset",
// Projects
PROJECT_CREATE: "project_create",

View File

@@ -582,7 +582,13 @@ const translations = {
theme: "Motyw",
themeDescription: "Wybierz preferowany motyw",
language: "Język",
languageDescription: "Wybierz preferowany język"
languageDescription: "Wybierz preferowany język",
password: "Hasło",
passwordDescription: "Zmień hasło do konta",
currentPassword: "Aktualne hasło",
newPassword: "Nowe hasło",
confirmPassword: "Potwierdź nowe hasło",
changePassword: "Zmień hasło"
}
},
@@ -1090,7 +1096,13 @@ const translations = {
theme: "Theme",
themeDescription: "Choose your preferred theme",
language: "Language",
languageDescription: "Select your preferred language"
languageDescription: "Select your preferred language",
password: "Password",
passwordDescription: "Change your account password",
currentPassword: "Current Password",
newPassword: "New Password",
confirmPassword: "Confirm New Password",
changePassword: "Change Password"
}
}
};

View File

@@ -452,5 +452,20 @@ export default function initializeDatabase() {
CREATE INDEX IF NOT EXISTS idx_field_history_table_record ON field_change_history(table_name, record_id);
CREATE INDEX IF NOT EXISTS idx_field_history_field ON field_change_history(table_name, record_id, field_name);
CREATE INDEX IF NOT EXISTS idx_field_history_changed_by ON field_change_history(changed_by);
-- Password reset tokens table
CREATE TABLE IF NOT EXISTS password_reset_tokens (
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
user_id TEXT NOT NULL,
token TEXT UNIQUE NOT NULL,
expires_at TEXT NOT NULL,
used INTEGER DEFAULT 0,
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
-- Create index for password reset tokens
CREATE INDEX IF NOT EXISTS idx_password_reset_token ON password_reset_tokens(token);
CREATE INDEX IF NOT EXISTS idx_password_reset_user ON password_reset_tokens(user_id);
`);
}