Back

[SOLVED] Change password

  • 0
  • Accounts
Said H
14 Feb, 2023, 14:46

Hello, what is the right way to pass oldPassword parameters to change password? I referred to the documentation, but i can't get it right.

The below gave me error Invalid password: Password must be at least 8 characters. I confirm that both my old and new password is >8 chars.

TypeScript
return account.updatePassword(
   {
     password: newPassword,
     oldPassword: currentPassword
   });

The below gave me error oldPassword is not defined.

TypeScript
return account.updatePassword(newPassword, currentPassword); 
TL;DR
The user was having trouble changing their password and encountered errors with the code syntax. They initially used the incorrect syntax but then updated it to the correct syntax. However, they still encountered an error stating that the oldPassword is not defined. They tried different combinations of passwords that were all over 8 characters long. The user is seeking guidance on the correct way to pass the oldPassword parameter for changing the password. No solution is provided in the thread.
Said H
14 Feb, 2023, 14:47

both newPassword and currentPassword are variables that I passed to the function

joeyouss
14 Feb, 2023, 15:38

Hi , thank you for your doubt, please allow me a moment to look into this and get back to you

Said H
14 Feb, 2023, 15:57

Thanks a lot

joeyouss
14 Feb, 2023, 16:14

Can you please once confirm which language this code belongs to?

Said H
14 Feb, 2023, 21:24

React.

joeyouss
15 Feb, 2023, 08:27

Hey, so the code snippet looks okay, can you please one share here the error msgs and network logs?

Amel1a
15 Feb, 2023, 08:27

Hi, joeyouss! VoidCupboard is currently AFK for a hot minute, he gotta deal with some shit (IRL). he will reply you as sson as he gets back ^-^

This is not the human you were looking for. It's just me, a bot!

Said H
15 Feb, 2023, 16:05

Hello @joeyouss , here you go. with the password that i keyed in. Also, i tried multiple combinations that are >8 chars.

Drake
15 Feb, 2023, 16:20

What exactly is your code now and what shows up in the payload tab rather than headers?

Said H
15 Feb, 2023, 22:18

I retried with another password, here's the payload and exact code

TypeScript
  const updatePassword = (newPassword, currentPassword) => {
    return account.updatePassword(
    {
      password: newPassword,
      oldPassword: currentPassword
    });
  };
Drake
15 Feb, 2023, 22:55

This syntax is incorrect. Update password takes 2 strings, not 1 object

Said H
15 Feb, 2023, 23:05

actually i tried the below before, and it gave me error oldPassword is not defined.

TypeScript
return account.updatePassword(newPassword, currentPassword); 
Said H
15 Feb, 2023, 23:05

let me retry now

Said H
15 Feb, 2023, 23:07

it works now!

Said H
15 Feb, 2023, 23:07

Thanks a lot

joeyouss
16 Feb, 2023, 05:13

Can we mark this as resolved?

Said H
16 Feb, 2023, 10:37

Absolutely. Thanks for all the help

joeyouss
16 Feb, 2023, 10:38

Always happy to be of use!

joeyouss
16 Feb, 2023, 15:04

[SOLVED] Change password

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more