mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 10:15:52 +01:00
introduced new exception classes for structured error reporting
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const passwordService = require('../../services/password');
|
||||
const ValidationError = require("../../public/app/services/validation_error.js");
|
||||
|
||||
function changePassword(req) {
|
||||
if (passwordService.isPasswordSet()) {
|
||||
@@ -14,7 +15,7 @@ function changePassword(req) {
|
||||
function resetPassword(req) {
|
||||
// protection against accidental call (not a security measure)
|
||||
if (req.query.really !== "yesIReallyWantToResetPasswordAndLoseAccessToMyProtectedNotes") {
|
||||
return [400, "Incorrect password reset confirmation"];
|
||||
throw new ValidationError("Incorrect password reset confirmation");
|
||||
}
|
||||
|
||||
return passwordService.resetPassword();
|
||||
|
||||
Reference in New Issue
Block a user