def check_user_info(self, email, nick, password, mobilenumber): try: validators.vemail(email) validators.vnick(nick) validators.vpassword(password) except Exception, e: return 99900, smart_unicode(e)
def reset_password_by_code(self, code, new_password_1, new_password_2): user = self.get_user_by_code(code) if not user: return 10112, dict_err.get(10112) if new_password_1 != new_password_2: return 10105, dict_err.get(10105) try: validators.vpassword(new_password_1) except Exception, e: return 99900, smart_unicode(e)
def change_pwd_by_admin(self, user_id, pwd): try: try: validators.vpassword(pwd) except Exception, e: return 99900, smart_unicode(e) user = self.get_user_login_by_id(user_id) user.password = self.set_password(pwd) user.save() # 更新缓存 self.get_user_by_id(user.id, must_update_cache=True)
def change_pwd(self, user, old_password, new_password_1, new_password_2): ''' @note: 密码修改 ''' if not all((old_password, new_password_1, new_password_2)): return 99800, dict_err.get(99800) if new_password_1 != new_password_2: return 10105, dict_err.get(10105) if not self.check_password(old_password, user.password): return 10106, dict_err.get(10106) if old_password == new_password_1: return 10107, dict_err.get(10107) try: validators.vpassword(new_password_1) except Exception, e: return 99900, smart_unicode(e)