Is it possible to use two step verification - OTP in web2py
i've tried on book two step verification with droidOTP even manual with 
pytop but the result is not expected (no error traceback occured but the 
result is not expected)
e.g. pyotp
*models/db.py*
from gluon.tools import Auth, Service, PluginManager

auth = Auth(db, host_names=myconf.get('host.names'))
service = Service()
plugins = PluginManager()

auth.settings.extra_fields['auth_user'] = [Field('motp_secret', 'password', 
length=512, default='', label='MOTP Secret')]

def _set_two_factor(user, auth_two_factor):
    return None

def verify_otp(user, otp):
    #totp = pyotp.TOTP(user.motp_secret)
    #return totp.verify(int(otp))

    import pyotp

    pyotp.random_base32() # generate random number

    totp = pyotp.TOTP('4DKTQHH2V2F7T2ZO')
    #totp.provisioning_uri("[email protected]")
    totp.now()

    #return totp.verify(int(otp) ) # return user base input 
    #return totp.verify(int(totp.now() ) ) # return totp.now not work
    return True # return true not work

auth.settings.actions_disabled.append('register')
auth.settings.auth_two_factor_enabled = True
auth.settings.two_factor_methods = [lambda user, auth_two_factor: 
_set_two_factor(user, auth_two_factor)]
auth.settings.two_factor_onvalidation = [lambda user, otp: verify_otp(user, 
otp)]

auth.define_tables(username=False, signature=False)

any idea how to use two step verification - otp in web2py? 
droidotp is not work in book example too, perhaps i missed the step, any 
hints?

thanks and best regards,
stifan

-- 
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