@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button';
44import { Input } from '@/components/ui/input' ;
55import { Label } from '@/components/ui/label' ;
66import { useAuth } from '@/hooks/useAuth' ;
7- import { updatePassword , reauthenticateWithCredential , EmailAuthProvider } from 'firebase/auth ' ;
7+ import { supabase } from '@/integrations/supabase/client ' ;
88import { useToast } from '@/hooks/use-toast' ;
99
1010interface AccountSecuritySettingsProps {
@@ -20,10 +20,10 @@ export const AccountSecuritySettings = ({ onCancel }: AccountSecuritySettingsPro
2020 const [ confirmPassword , setConfirmPassword ] = useState ( '' ) ;
2121
2222 const handleUpdatePassword = async ( ) => {
23- if ( ! user || ! currentPassword || ! newPassword ) {
23+ if ( ! user || ! newPassword ) {
2424 toast ( {
2525 title : "Erreur" ,
26- description : "Tous les champs sont requis" ,
26+ description : "Nouveau mot de passe requis" ,
2727 variant : "destructive" ,
2828 } ) ;
2929 return ;
@@ -49,10 +49,12 @@ export const AccountSecuritySettings = ({ onCancel }: AccountSecuritySettingsPro
4949
5050 setLoading ( true ) ;
5151 try {
52- const credential = EmailAuthProvider . credential ( user . email ! , currentPassword ) ;
53- await reauthenticateWithCredential ( user , credential ) ;
52+ const { error } = await supabase . auth . updateUser ( {
53+ password : newPassword
54+ } ) ;
55+
56+ if ( error ) throw error ;
5457
55- await updatePassword ( user , newPassword ) ;
5658 toast ( {
5759 title : "Mot de passe mis à jour" ,
5860 description : "Votre mot de passe a été modifié avec succès" ,
0 commit comments