Example #1
0
def main(email, password, force):
    newWeather = getWeather()
    if (newWeather != readInFile('weather')) or force:
        login(email if email else readInFile('email'),
              password if password else readInFile('password'))
        if updateAllocations(newWeather):
            saveInFile('weather', newWeather)
Example #2
0
def login():
    if 'user_name' in request.json:
        user_name = request.json.get('user_name')
    else:
        raise GenericError("user_name not provided")

    return jsonify(user_service.login(user_name))
Example #3
0
 def post(self):
     parser = reqparse.RequestParser()
     parser.add_argument('AadharNo',
                         required=True,
                         type=int,
                         help='AadharNo cannot be found')
     args = parser.parse_args()
     aadhar = args['AadharNo']
     return jsonify(user.login(aadhar))
Example #4
0
    def post(self, request, data):
        success, result, errors = login(
                data["login_data"].email,
                data["login_data"].password
        )

        if errors:
            return BadRequest(errors)

        return Ok(result)
Example #5
0
def test_login_ok():
    password = "******"
    with patch('services.user.get_user_by_email') as mock:
        user = build_user()
        user.password = hashpw(password, gensalt())
        mock.return_value = user
        ok, data, errors = login("*****@*****.**", password)
        assert mock.call_count == 1
        assert ok is True
        assert 'token' in data
Example #6
0
def test_login_fail():
    password = "******"
    with patch("services.user.get_user_by_email") as mock:
        user = build_user()
        user.password = hashpw(password, gensalt())
        mock.return_value = user
        ok, data, errors = login("*****@*****.**", "bbb")
        assert mock.call_count == 1
        assert ok is False
        assert "email" in errors
Example #7
0
def displayLogin():
    username = input('Username: '******'Password: '******'msg'])
    _uAuth.storeTokens(t_type='access', token=r.body['access_token'])
    return _pageLogged.menu()