feat(auth): adds local account authentication

This commit is contained in:
2025-05-12 15:45:12 -04:00
parent 6d7282870d
commit fdfca7c757
24 changed files with 1446 additions and 279 deletions

View File

@@ -244,6 +244,29 @@ export const useAuthStore = defineStore('auth', () => {
return isExpiring;
}
async function changePassword(newPassword) {
console.log('changePassword called');
if (!isAuthenticated.value) {
throw new Error('User must be authenticated to change password');
}
if (!newPassword) {
throw new Error('New password is required');
}
try {
const response = await clientApi.post('api/users/set-password', {
newPassword
});
console.log('Password changed successfully');
return true;
} catch (error) {
console.error('Password change failed:', error);
throw error;
}
}
return {
accessToken,
refreshToken,
@@ -255,6 +278,7 @@ export const useAuthStore = defineStore('auth', () => {
loginWithFacebook,
logout,
refresh,
isTokenExpiringSoon
isTokenExpiringSoon,
changePassword
};
});