mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-07-02 21:01:55 +08:00
feat: implement address password authentication feature (#731)
* feat: implement address password authentication feature - Add password field to address table for storing hashed passwords - Implement address authentication APIs (login, change password) - Add automatic password generation for new addresses - Support password login alongside credential login in frontend - Add password management in account settings and admin panel - Add ENABLE_ADDRESS_PASSWORD environment variable for feature control - Update documentation and i18n support - Enhance security with SHA-256 password hashing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: upgrade dependencies --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -296,6 +296,13 @@ export const checkUserPassword = (password: string) => {
|
||||
return true;
|
||||
}
|
||||
|
||||
export const hashPassword = async (password: string): Promise<string> => {
|
||||
// use crypto to hash password
|
||||
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(password));
|
||||
const hashArray = Array.from(new Uint8Array(digest));
|
||||
return hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');
|
||||
}
|
||||
|
||||
export default {
|
||||
getJsonObjectValue,
|
||||
getSetting,
|
||||
|
||||
Reference in New Issue
Block a user