Browse Source

auth work

reid 2 năm trước cách đây
mục cha
commit
3b266ccd88
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      auth/auth.go

+ 3 - 3
auth/auth.go

@@ -139,10 +139,10 @@ func CheckToken(token map[string]string, conn *websocket.Conn, r *http.Request,
 			ip, _, _ = net.SplitHostPort(r.RemoteAddr)
 		}
 		userAgent := r.Header.Get("User-Agent")
-		hashed := sha512.Sum512([]byte(token["token"]))
-		hash := hex.EncodeToString(hashed[:])
+		// hashed := sha512.Sum512([]byte(token["token"]))
+		// hash := hex.EncodeToString(hashed[:])
 		// you in auth map?
-		if WsIsAuthenticated(conn, hash) {
+		if WsIsAuthenticated(conn, token["id"]) {
 			if ip == res["ip"] && userAgent == res["user_agent"] {
 				config.Logger.Info("Token authenticated")
 				return true