def muser(self): """ model of user """ if not hasattr(self, "_user_model"): self._user_model = user.UserModel(self.db) return self._user_model
def signup(): request_data = request.get_json() if (user.UserModel.find_by_name(request_data['username'])): return {'message': 'O e-mail informado já esta sendo utilizado'}, 409 new_user = user.UserModel(name=request_data['username'], password=request_data['password']) new_user.save_to_db() return new_user.json()
def signup(): request_data = request.get_json() # Caso o email já exista, devolve conflito (status 409) if (user.UserModel.find_by_name(request_data['username'])): return {'message': 'email já encontrado'}, 409 new_user = user.UserModel(name=request_data['username'], password=request_data['password']) new_user.save_to_db() return new_user.json()
def signup(): request_data = request.get_json() new_user = user.UserModel(name=request_data["username"], password=request_data["password"]) new_user.save_to_db()