Exemplo n.º 1
0
 def user_modify_check(result, flag):
     str_check_empty = "<script language='javascript'>alert('用户名或密码不能为空');window.history.back(-1);</script>"
     str_check_existed = "<script language='javascript'>alert('用户名已经存在');window.history.back(-1);</script>"
     str_check_length = "<script language='javascript'>alert('密码长度大于20位');window.history.back(-1);</script>"
     if result["user_name"] == "" or result["user_password"] == "":
         return str_check_empty
     elif len(result["user_password"]) == 32:
         return "md5"
     elif len(result["user_password"]) >= 20:
         return str_check_length
     elif len(result["user_password"]) < 20:
         if flag:
             check_username = UserSqlOperation.user_modify_check(result["user_name"])
             if check_username and check_username[0][0] == result["user_name"]:
                 return str_check_existed
             else:
                 return "ok"
         else:
             return "ok"
Exemplo n.º 2
0
 def user_modify_check(result, flag):
     str_check_empty = "<script language='javascript'>alert('用户名或密码不能为空');window.history.back(-1);</script>"
     str_check_existed = "<script language='javascript'>alert('用户名已经存在');window.history.back(-1);</script>"
     str_check_length = "<script language='javascript'>alert('密码长度大于20位');window.history.back(-1);</script>"
     if result["user_name"] == "" or result["user_password"] == "":
         return str_check_empty
     elif len(result["user_password"]) == 32:
         return "md5"
     elif len(result["user_password"]) >= 20:
         return str_check_length
     elif len(result["user_password"]) < 20:
         if flag:
             check_username = UserSqlOperation.user_modify_check(
                 result["user_name"])
             if check_username and check_username[0][0] == result[
                     "user_name"]:
                 return str_check_existed
             else:
                 return "ok"
         else:
             return "ok"