Kaynağa Gözat

注册绑定邀请邮箱

visuddhinanda 4 yıl önce
ebeveyn
işleme
16cf3c46f1
1 değiştirilmiş dosya ile 10 ekleme ve 2 silme
  1. 10 2
      app/db/user.php

+ 10 - 2
app/db/user.php

@@ -85,13 +85,15 @@ class User extends Table
 				echo json_encode($this->result, JSON_UNESCAPED_UNICODE);	
 				return;	
 			}
-			$code = $this->redis->exists("invitecode://".$data["invite"]);
+			$redisKey = "invitecode://".$data["invite"];
+			$code = $this->redis->exists($redisKey);
 			if(!$code){
 				$this->result["ok"]=false;
 				$this->result["message"]="invite_code_invalid";
 				echo json_encode($this->result, JSON_UNESCAPED_UNICODE);	
 				return;	
 			}
+			$data["email"] = $this->redis->get($redisKey);				
 		}else{
 			$this->result["ok"]=false;
 			$this->result["message"]="no_invite_code";
@@ -138,7 +140,8 @@ class User extends Table
 													"summary"=>""
 													]);
 					echo json_encode($newChannel1, JSON_UNESCAPED_UNICODE);
-					
+					//删除
+					$this->redis->del($redisKey);
 				}else{
 					echo json_encode($result, JSON_UNESCAPED_UNICODE);
 				}
@@ -298,6 +301,11 @@ class User extends Table
 			$this->result["message"]="username_too_long";
 			return false;
 		}
+		if(mb_strlen($username,"UTF-8")<4){
+			$this->result["ok"]=false;
+			$this->result["message"]="username_too_short";
+			return false;
+		}
 		if(preg_match("/@|\s|\//",$username)!==0){
 			$this->result["ok"]=false;
 			$this->result["message"]="char_error";