On Sunday, July 17, 2016 at 12:53:40 PM UTC-4, Bernardo Leon wrote: > > Thank you for your reply > > my web2py version is: Version 2.12.3-stable+timestamp.2015.08.19.00.18.03 >
The settings and functionality you are attempting to use were not released until version 2.13.1 (there was prior support for two-factor authentication, but it was more basic and did not include the settings in question). > And finally thanks for your observation about lambdas, If I understand you > I should leave it like this?: > > auth.settings.two_factor_methods = [_set_two_factor(user, auth_two_factor > )] > auth.settings.two_factor_onvalidation = [verify_otp(user, otp)] > No, you just need to specify the functions: auth.settings.two_factor_methods = [_set_two_factor] auth.settings.two_factor_onvalidation = [verify_otp] Note, that lambda x: func(x) is simply equivalent to func. The reason you often see a lambda function is because the function you ultimately want to call does not have the proper signature, so you use the lambda to generate a new function with the required signature, and then let the lambda call the ultimate function with the proper arguments. However, if the ultimate function already has the proper signature, there is no reason to wrap it in a lambda with the exact same signature. Ultimately, the callback just needs to be any callable object (whether a normal function, a lambda function, a static method of a class, or an instance of a callable class) with the proper signature (i.e., that accepts the arguments that the caller will pass to it). Anthony -- 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.