AppFoundation authentication how to unlock user account?

Hello Everybody, I’m new to Vaadin and I’m working on my first Application, I’m using the AppFoundation Add-on to do authentication, my question is if a user gets his account locked, how do I unlock the user account?

I tried to unlock it updating in the database the fields FailedLoggedAttempts, ReasonForLockedAccount and AccountLocked, but when I tried to login again I received the AccountLockedException, if I restart Tomcat the login works fine.

Thanks a lot for your help.

Best Regards,
Robert

This should do the trick

User user = FacadeFactory.getFacade().find(User.class, idOfLockedAccount);
user.clearFailedLoginAttempts();
user.setAccountLocked(false);
FacadeFactory.getFacade().store(user);

Take a look at the
accountUnlocked test
which verifies that this approach should work. If you continue struggling with this, please try to make a test case or provide me some code so that I can see what might be going wrong.

  • Kim

Hello Kim, thanks a lot, that worked perfectly.

I was updating the same fields but directly in the database via a query tool, so the Vaadin application didn’t get the change.

Congratulations for the AppFoundation, it’s really helpful.

Best Regards,
Robert