diff --git a/cmd/resetPassword.go b/cmd/resetPassword.go index 3501241..9a2fe89 100644 --- a/cmd/resetPassword.go +++ b/cmd/resetPassword.go @@ -25,7 +25,10 @@ You can provide the password or the user or if left empty, Kamanda will automati if password == "" { passwordToSave = utils.PasswordGenerator(10) } - user, err := auth.UpdateFirebaseUserPassword(context.Background(), v, passwordToSave) + updatePassword := &auth.FirebaseUser{ + Password: password, + } + user, err := auth.UpdateFirebaseUser(context.Background(), v, updatePassword) if err != nil { hasError = true utils.StdOutError(os.Stderr, "Error updating user %s password\n", v) diff --git a/firebase/auth/auth.go b/firebase/auth/auth.go index becebc5..53b69c4 100644 --- a/firebase/auth/auth.go +++ b/firebase/auth/auth.go @@ -56,24 +56,6 @@ func NewFirebaseUser(ctx context.Context, user *FirebaseUser) (*auth.UserRecord, return u, nil } -// UpdateFirebaseUserPassword update a users password on Firebase Auth. -func UpdateFirebaseUserPassword(ctx context.Context, UID string, password string) (*auth.UserRecord, error) { - params := &auth.UserToUpdate{} - if password == "" { - return nil, fmt.Errorf("Password cannot be empty") - } - params = params.Password(password) - client, err := firebase.Auth(ctx, "", "") - if err != nil { - return nil, fmt.Errorf("Error authenticating firebase account: %w", err) - } - u, err := client.UpdateUser(ctx, UID, params) - if err != nil { - return nil, firebase.NewError(err) - } - return u, nil -} - // UpdateFirebaseUser update a user details on firebase. func UpdateFirebaseUser(ctx context.Context, UID string, user *FirebaseUser) (*auth.UserRecord, error) { params := &auth.UserToUpdate{}