def put(self, token): user = UserModel.verify_token(token) if not isinstance(user, UserModel): return user user.set_status(1) return {'msg': 'You successfuly activated your account!'}, 200
def put(self): data = User.get_update_args() token = request.headers.get('x-auth') user = UserModel.verify_token(token) if not user.check_password(data['old_password']): return {'msg': 'Password is incorrect!'}, 400 if data['new_password'] != data['confirm_password']: return {'msg': 'Passwords don\'t match'}, 400 user.first_name = data['first_name'] user.last_name = data['last_name'] user.password = user.hash_password(data['new_password']) user.save_to_db() return {'msg': 'You successfully changed your password'}, 200