fixed reset password
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user