Ejemplo n.º 1
0
 def put(self, userid):
     value = request.get_json()
     user = UserModel.findById(userid)
     if user is not None:
         user.name = value['name']
         user.email = value['email']
         user.insert()
         return userschema.dump(user)
     return log.ISNOTEXIST(), 404
Ejemplo n.º 2
0
    def post(self):
        value = request.get_json()
        value.update({'registerDate': int(time())})

        user = userschema.load(value)
        isName = UserModel.findByName(user.name)
        isEmail = UserModel.findByEmail(user.email)

        if isName is None and isEmail is None:
            user.insert()  # savetodatabase
            confirm = ConfirmationModel(user.userId)
            confirm.insert()
            user.sendMsg()
            return userschema.dump(user)
        return log.ISEXIST(), 400
Ejemplo n.º 3
0
def user_claims_loader(identity):
    user = UserModel.findById(identity)
    request.user = userschema.dump(user)
    return request.user
Ejemplo n.º 4
0
 def delete(self, userid):
     user = UserModel.findById(userid)
     if user is not None:
         user.delete()
         return userschema.dump(user)
     return log.ISNOTEXIST(), 404