fixed reset password

This commit is contained in:
2026-06-02 10:55:26 +02:00
parent 3c33c8765a
commit 6a6e792cd9
8 changed files with 171 additions and 24 deletions

View File

@@ -105,12 +105,15 @@ class StaffRepository {
}
Future<void> resetPassword(String email) async {
//TODO modificare per fare il reset della password tramite edge function, così da poter personalizzare l'email e il link di reset
try {
await _supabase.auth.resetPasswordForEmail(
email,
redirectTo: resetPasswordUrl,
final response = await Supabase.instance.client.functions.invoke(
'reset_password',
body: {'email': email.trim()},
);
if (response.status != 200) {
throw Exception(response.data['error'] ?? "Errore sconosciuto");
}
} catch (e) {
throw Exception("Errore nell'invio del link: $e");
}