Эх сурвалжийг харах

Added not tested redirection on auto login token

Toby Chui 3 жил өмнө
parent
commit
a5121a2b62

+ 1 - 1
mod/agi/agi.go

@@ -27,7 +27,7 @@ import (
 */
 
 var (
-	AgiVersion string = "1.5" //Defination of the agi runtime version. Update this when new function is added
+	AgiVersion string = "1.6" //Defination of the agi runtime version. Update this when new function is added
 )
 
 type AgiLibIntergface func(*otto.Otto, *user.User) //Define the lib loader interface for AGI Libraries

+ 9 - 2
mod/auth/autologin.go

@@ -163,8 +163,15 @@ func (a *AuthAgent) HandleAutologinTokenLogin(w http.ResponseWriter, r *http.Req
 
 	session.Save(r, w)
 
-	//Redirect this client to its interface module
-	http.Redirect(w, r, "/", 307)
+	redirectTarget, _ := mv(r, "redirect", false)
+	if redirectTarget != "" {
+		//Redirect to target website
+		http.Redirect(w, r, redirectTarget, http.StatusTemporaryRedirect)
+	} else {
+		//Redirect this client to its interface module
+		http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
+	}
+
 }
 
 //Check if the given autologin token is valid. Autologin token is different from session token (aka token)