def post(cls): data = attribute.parse_args() user = UserModel.find_by_login(data['login']) if user and safe_str_cmp(user.password, data['password']): token = create_access_token(identity=user.user_id) return {'acess_token': token}, 200 return {'messege': "Username or Password is Wrong."}, 401
def post(self): data = attribute.parse_args() if UserModel.find_by_login(data['login']): return { "message": "Login '{}' already exists.".format(data['login']) } user = UserModel(**data) user.save_user() return {'message': 'User created successfully'}, 201
def post(cls): data = attributes.parse_args() user = UserModel.find_by_login(data['login']) if user and cls.valid_password(data['password'], user.password): token_de_acesso = create_access_token(identity=user.id) return {'access_token': token_de_acesso}, 200 return {'message': 'The user name or password is incorrect'}, 401
def post(self): data = attributes.parse_args() city = data['city'].lower().capitalize() data['city'] = city if UserModel.find_by_login(data['login']): return { 'massage': "The login {} alredy exists.".format(data['login']) } password_encrypt = self.encrypt_password(data['password']) data['password'] = password_encrypt user = UserModel(**data) user.save_user() return {"message": "User cread successfully"}, 201