feature: password reset

This commit is contained in:
asterisk727
2025-07-26 01:20:07 -05:00
committed by Azalea
parent e0d12acf61
commit 82adf5c138
8 changed files with 496 additions and 12 deletions

View File

@@ -163,12 +163,22 @@ async function login(user: { email: string, password: string, turnstile: string
localStorage.setItem('token', data.token)
}
async function resetPassword(user: { email: string, turnstile: string }) {
return await post('api/v2/user/reset-password', user)
}
async function changePassword(user: { code: string, password: string }) {
return await post('/api/v2/user/change-password', user)
}
const isLoggedIn = () => !!localStorage.getItem('token')
const ensureLoggedIn = () => !isLoggedIn() && (window.location.href = '/')
export const USER = {
register,
login,
resetPassword,
changePassword,
confirmEmail: (token: string) =>
post('/api/v2/user/confirm-email', { token }),
me: (): Promise<AquaNetUser> => {