Example #1
0
def userlist():
    """ List all users"""

    try:
        for user in User.select():
            print user.login
    except Exception, e:
        print "Unexpected error: %s" % e
Example #2
0
def useradd(login=None, count=5):
    """ Add a user"""

    secret = random_base32()

    if login is None:
        login = prompt("Login: "******"Scan QR: http://2qr.ru/otpauth://totp/%(issuer)s:%(login)s?secret=%(secret)s&issuer=%(issuer)s" % (
            {'issuer': issuer, 'login': login, 'secret': secret})

        print "Or add manually SECRET KEY: %s" % secret
        print "Emergency codes: %s" % emergency_list
    except Exception, e:
        print "Unexpected error: %s" % e
Example #3
0
def userdel(login=None):
    """ Remove a user"""

    if login is None:
        login = prompt("Login: "******"User has been deleted"
    except User.DoesNotExist:
        print "User not found"
    except Exception, e:
        print "Unexpected error: %s" % e
Example #4
0
def renew(login=None, count=5):
    """ Renew a emergency codes"""

    if login is None:
        login = prompt("Login: "******"User not found"
    except Exception, e:
        print "Unexpected error: %s" % e