def post(self): password = self.json.password _password = User.encrypt_pwd(self.json.password) if self.current_user.password != _password: res = u'Password Not Right!' else: res = u'Ok!' self.finish(dict(res=res))
def post(self): err = JsOb() form = self.json if not form.new_password: err.password = u'Please input password' elif not is_valid_password(form.new_password): err.password = u'Password not valid' new_password = User.encrypt_pwd(self.json.new_password) if not err: self.current_user.password = new_password self.current_user._id = int(self.current_user_id) self.current_user.save() self.render(err)
def data_init(): _t = DateTime() for r in ['AM', 'Affiliate', 'Advertiser', 'BD', 'PM']: role = Role( dict(_id=gid(GidKey.role_key), name=r, permission=[], createdTime=_t.current_time, last_update=_t.current_time, deleted=False)) role.save() user = User( dict(_id=gid(GidKey.user_key), account='admin', email=['*****@*****.**'], password=User.encrypt_pwd(u'chizicheng521'), role_id='', is_admin=True, createdTime=_t.current_time, last_update=_t.current_time, last_login=_t.current_time, deleted=False)) user.save()
def post(self): new_password = User.encrypt_pwd(self.json.new_password) self.current_user.password = new_password self.current_user._id = int(self.current_user_id) self.current_user.save() self.finish(dict(res=True))