def post(self):
     """
     Receive Authorization token given user credentials
     Limited to 10 requests per 1 minute.
     """
     post_data = request.json
     return Auth.login_user(data=post_data)
示例#2
0
 def post(self):
     LOG.info('=================---------------------- logging in..')
     post_data = request.json
     result = Auth.login_user(api, data=post_data)
     if isinstance(result, dict):
         return result
     else:
         api.abort(401, result)
示例#3
0
 def post(self):
     post_data = request.get_json(force=True)
     LOG.info(post_data)
     tcp_log(post_data)
     ok, err = login_validate(post_data)
     if not ok:
         return build_json_error(err, 400, 'Błąd walidacji',
                                 'Validation failed')
     return Auth.login_user(data=post_data)
示例#4
0
    def post(self):
        # get the post data
        post_data = request.json
        msg, status = Auth.login_user(data=post_data)
        if status != 200:
            return msg, status

        user = User.objects(email=post_data.get('email')).first()
        start_threads(user)

        return msg, status
示例#5
0
    def put(self):
        """User update new password"""
        user = g.user

        data = request.json
        old_password = data.get('old_password')
        new_password = data.get('new_password')

        data = {'email': user.email, 'password': old_password}
        res, status = Auth.login_user(data=data)
        if status != 200:
            response_object = {
                'status': 'fail',
                'message': 'Wrong old password'
            }
            return response_object, 401
        return save_updated_password(user, new_password)
 def post(self):
     # get the post data
     post_data = request.json
     code = Auth.login_user(data=post_data)
     if code == 200:
         access_token = create_access_token(identity=post_data.get('user_id'), expires_delta=EXPIRE_TOKEN)
         # TODO: jsonnify seems does not work with flask_restplus
         # analize the best way to return the "access_token"
         return jsonify(access_token=access_token)
     elif code == 401:
         return {
                    'status': 'fail',
                    'message': "Bad username or password"
                }, 401
     else:
         return {
                    'status': 'fail',
                    "msg": "Internal error. Piece of Cake"
                }, 500
示例#7
0
 def post(self):
     """Login the user"""
     post_data = request.json
     return Auth.login_user(data=post_data)
示例#8
0
 def post(self):
     # get the post data
     post_data = request.json
     resp, code = Auth.login_user(data=post_data)
     return marshal(resp, auth_resp), code
 def post(self) -> Tuple[Dict[str, str], int]:
     # get the post data
     print('Start login')
     post_data = request.json
     return Auth.login_user(data=post_data)
示例#10
0
 def post(self):
     post_data = request.json
     print(post_data)
     return Auth.login_user(data=post_data)
示例#11
0
 def post(self):
     data = request.json
     return Auth.login_user(data)
示例#12
0
 def post(self):
     # get the post data
     post_data = request.json
     print("input =>", post_data)
     return Auth.login_user(data=post_data)
示例#13
0
 def post(self):
     """User Login """
     data = _user_parser.parse_args()
     return Auth.login_user(data)
示例#14
0
 def post(self):
     data = parser.parse_args()
     return Auth.login_user(data=data)
示例#15
0
 def post(self):
     # get the post data
     post_data = request.form.to_dict()
     return Auth.login_user(data=post_data)
示例#16
0
 def post(self):
     """Login and get a token for auth"""
     # get the post data
     post_data = request.json
     return Auth.login_user(data=post_data)
示例#17
0
 def post(self):
     # get the post data
     post_data = request.json
     return Auth.login_user(data=post_data)
示例#18
0
 def post(self):
     """User Login"""
     post_data = request.json
     return Auth.login_user(data=post_data)