chore: clean up code by removing trailing whitespace and ensuring consistent formatting across various files = prettier
This commit is contained in:
@@ -20,7 +20,11 @@ async function ensurePasswordFile(): Promise<void> {
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
await fs.writeFile(PASSWORD_FILE, JSON.stringify(defaultData, null, 2), "utf-8");
|
||||
await fs.writeFile(
|
||||
PASSWORD_FILE,
|
||||
JSON.stringify(defaultData, null, 2),
|
||||
"utf-8",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +49,10 @@ export const authService = {
|
||||
}
|
||||
},
|
||||
|
||||
async changePassword(oldPassword: string, newPassword: string): Promise<{ success: boolean; error?: string }> {
|
||||
async changePassword(
|
||||
oldPassword: string,
|
||||
newPassword: string,
|
||||
): Promise<{ success: boolean; error?: string }> {
|
||||
try {
|
||||
// Verify old password
|
||||
const isValid = await this.verifyPassword(oldPassword);
|
||||
@@ -56,17 +63,20 @@ export const authService = {
|
||||
// Hash new password
|
||||
const newHash = await bcrypt.hash(newPassword, 10);
|
||||
const data = await loadPasswordData();
|
||||
|
||||
|
||||
// Update password
|
||||
data.hash = newHash;
|
||||
data.updatedAt = new Date().toISOString();
|
||||
|
||||
|
||||
await savePasswordData(data);
|
||||
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Error changing password:", error);
|
||||
return { success: false, error: "Erreur lors du changement de mot de passe" };
|
||||
return {
|
||||
success: false,
|
||||
error: "Erreur lors du changement de mot de passe",
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
@@ -79,4 +89,3 @@ export const authService = {
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user