Found a solution

def check_if_user_is_active(form):
    """Check if user is active."""
    if not db.auth_user(username=form.vars.username).is_active:
        session.flash = T('That username is not active.')
        redirect(URL('user', 'login'))


auth.settings.login_onvalidation.append(check_if_user_is_active)


Is there a better way?


quarta-feira, 3 de Abril de 2019 às 01:25:22 UTC+1, João Matos escreveu:
>
> Hello,
>
> How can I block logins from users with is_active == False?
>
> Thanks,
>
> JM
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to