def post(self, *args, **kwargs): user_name = self.get_angular_argument('user_name') password = self.get_angular_argument('password') check = FFAdmin.check_pass(user_name, password) if check: self.session['uid'] = check self.write(dict(ret=0)) else: self.write(dict(ret=1, msg='密码错误'))
def post(self, *args, **kwargs): user_id = self.get_angular_argument('id') user_name = self.get_angular_argument('user_name') password = self.get_angular_argument('password') if not user_id: self.on_error(**ErrorCodeMessage.user_not_exists) return ff_admin = FFAdmin.init_from_user_id(user_id) if ff_admin.edit_user_info(user_name, password): self.on_success() return self.on_error(**ErrorCodeMessage.database_error)
def post(self, *args, **kwargs): user_name = self.get_angular_argument('name') password = self.get_angular_argument('password') # check user name length if len(user_name) < 1 or len(user_name) > 20: self.on_error(**ErrorCodeMessage.user_name_illegal) return # check password length if len(password) > 20 or len(password) < 6: self.on_error(**ErrorCodeMessage.password_illegal) return # check user_name if not FFAdmin.check_user_name(user_name): self.on_error(**ErrorCodeMessage.user_name_exists) return ff_admin = FFAdmin.add(user_name, password) if not ff_admin: self.on_error(**ErrorCodeMessage.database_error) return self.on_success(ff_admin.to_dict())
def post(self, *args, **kwargs): admin_id = self.get_angular_argument('id') action = self.get_angular_argument('action') admin = FFAdmin.init_from_user_id(admin_id) if not admin: self.on_error(**ErrorCodeMessage.user_not_exists) return if action == 'del': res = admin.delete() else: res = admin.recover() if res: self.on_success() return else: self.on_error(**ErrorCodeMessage.database_error)
def get(self, *args, **kwargs): admin_instance_list = FFAdmin.get_all_admin_list() res = [] for admin in admin_instance_list: res.append(admin.to_dict()) self.on_success(res)