Support Topics Documentation Slack YouTube Blog

Letting users change their password - can I reset userStatus back to DISABLED?

Basically, in my app users can change their email addresses. The update code works just fine but it doesn’t reset the userStatus back to DISABLED. I would like them to have to validate their accounts again to prevent them from getting locked out if they screwed up the change to their email address.

static Future<bool> updateEmail(String email) async {
var user = await Backendless.userService.currentUser();
user.setProperty('email', email);
user.setProperty('userStatus', 'DISABLED');
return Backendless.userService.update(user).then((result) => true);
  }

Zapier could accomplish this for you!

Hi @Carlton_Branch!

Thank you for using Backendless.
That is true that update for users doesn’t change status.
For changing user status you should use next methods from Backendless.userService:

  async enableUser(userId)

  async disableUser(userId)

Unfortunatelly, this methods is undocumented at the current moment but we will add documentation for them in nearest future.

If you have any further questions, I will be happy to help you.

Regards, Andriy

Thanks.
In which version of backendless is this found?
Where should I be looking to keep my version of the backendless sdk up to date?

This isn’t in the Flutter SDK is it? I updated to ^6.1.0 and those methods are not present in the userservice class.

Hi @Carlton_Branch!
I am sorry but it looks like I misguided you. I though that you are using JS SDK. This methods available only in JS SDK and only with CloudCode (BL) API Key. There also REST route present but it also works only with CloudCode (BL) API Key. We do not allow status change from client apps for security reasons.
So you need to create a custom BL service and call it any time when you need to change user status.

Regards, Andriy.