I just tested and it works fine except it seems that the documentation in the book is incorrect.
You must add this line to db.py (or in whatever file you define the auth and set auth.settings); auth.settings.two_factor_authentication_group = 'web2py Two-Step Authentication' Other things to note: - You must have a group with this name in auth_group - You must add user to this group - You must have email setup in order to receive the two factor authentication code I'll submit a fix to the documentation in the book. On Tuesday, December 9, 2014 1:50:33 PM UTC-5, pn wrote: > > I contributed this originally, will take a look today. Should be an easy > fix. > > On Monday, December 8, 2014 9:27:35 PM UTC-5, Massimo Di Pierro wrote: >> >> Honestly I have not used this much myself recently. Please open a ticket >> about this problem. It may be broken. >> v >> >> On Friday, 5 December 2014 11:34:29 UTC-6, Andrew wrote: >>> >>> Following the information in the web2py book I have attempted to enable >>> 2 factor authentication. It does not seem to be working though. >>> >>> I have set up a group with the role of "web2py Two-Step Authentication" >>> I assign users to this with >>> >>> auth.settings.create_user_groups = False >>> auth.settings.everybody_group_id = 3 >>> >>> >>> However after the failed login attempts nothing happens. I am even free >>> to login as normal. >>> I am using a custom auth table with the following: >>> >>> >>> db.define_table(auth.settings.table_user_name, >>> Field('first_name', requires=[IS_NOT_EMPTY(), IS_LENGTH(minsize=3, >>> maxsize=15)]), >>> Field('last_name', requires=[IS_NOT_EMPTY(), IS_LENGTH(minsize=3, >>> maxsize=15)]), >>> Field('email'), >>> Field('username', unique=True), >>> Field('password', 'password', length=512, >>> readable=False, label='Password'), >>> Field('current_ip', default=request.client, readable=False, writable >>> =False), >>> Field('registration_key', length=512, >>> writable=False, readable=False), >>> Field('reset_password_key', length=512, >>> writable=False, readable=False), >>> Field('registration_id', length=512, writable=False, readable=False >>> )) >>> >>> auth.settings.create_user_groups = False >>> auth.settings.everybody_group_id = 3 >>> auth.settings.actions_disabled=['change_password', >>> 'request_reset_password'] >>> auth.settings.formstyle = 'bootstrap' >>> auth.settings.remember_me_form = False >>> auth.define_tables() >>> auth.settings.register_captcha = Recaptcha(request, '', '', use_ssl=True >>> , options="theme : 'clean'") >>> auth.settings.login_onaccept.append(lambda form: db.auth_user(auth. >>> user_id).update_record(current_ip = request.client)) >>> >>> >>> >>> I am using web2py version: 2.9.11-stable+timestamp.2014.09.15.23.35.11 >>> >>> Any advice is greatly appreciated >>> >>> Thank You :D >>> >> -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.