Пример #1
0
def test_auth_passwordreset_reset_invalidResetCode():
    restart()
    auth_register('*****@*****.**', '123456', 'gaoping', 'zhang')
    auth_passwordreset_request('*****@*****.**')

    with pytest.raises(ValueError, match=r".*"):
        auth_passwordreset_reset('123', '123456')
Пример #2
0
def test_auth_passwordreset_request_1():
    restart()
    auth_register('*****@*****.**', '123456', 'gaoping', 'zhang')
    auth_passwordreset_request('*****@*****.**')
    DATA = load()
    userDict = DATA['userDict']
    reset_code = userDict[0]['reset_code']
    assert len(str(reset_code)) == 6
Пример #3
0
def test_auth_passwordreset_reset_invalidNewPassword():
    restart()
    auth_register('*****@*****.**', '123456', 'gaoping', 'zhang')
    auth_passwordreset_request('*****@*****.**')
    DATA = load()
    userDict = DATA['userDict']
    reset_code = userDict[0]['reset_code']

    with pytest.raises(ValueError, match=r".*"):
        auth_passwordreset_reset(reset_code, '1')
Пример #4
0
def test_auth_passwordreset_reset_1():
    restart()
    auth_register('*****@*****.**', '123456', 'gaoping', 'zhang')
    auth_passwordreset_request('*****@*****.**')
    DATA = load()
    userDict = DATA['userDict']
    reset_code = userDict[0]['reset_code']

    auth_passwordreset_reset(reset_code, '000000')
    DATA = load()
    userDict = DATA['userDict']
    assert userDict[0]['password'] == hashPassword('000000')
    assert userDict[0]['reset_code'] == 0
Пример #5
0
def password_request():
    email = request.form.get('email')
    mail = Mail(APP)
    try:
        msg = Message("Slackr Password Reset Number",
                      sender="*****@*****.**",
                      recipients=[email])
        msg.body = str(auth_passwordreset_request(email))
        mail.send(msg)
        return {}
    except Exception as e:
        return str(e)
    return dumps({})