#2748 fix redirect loop with auto-signin
This commit is contained in:
		
					parent
					
						
							
								dfbda48afc
							
						
					
				
			
			
				commit
				
					
						f6759a731a
					
				
			
		
					 4 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
					@ -3,7 +3,7 @@ Gogs - Go Git Service [
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##### Current version: 0.8.53
 | 
					##### Current version: 0.8.54
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Web | UI  | Preview  |
 | 
					| Web | UI  | Preview  |
 | 
				
			||||||
|:-------------:|:-------:|:-------:|
 | 
					|:-------------:|:-------:|:-------:|
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								gogs.go
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
										
									
									
									
								
							| 
						 | 
					@ -17,7 +17,7 @@ import (
 | 
				
			||||||
	"github.com/gogits/gogs/modules/setting"
 | 
						"github.com/gogits/gogs/modules/setting"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_VER = "0.8.53.0303"
 | 
					const APP_VER = "0.8.54.0304"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
						runtime.GOMAXPROCS(runtime.NumCPU())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -113,7 +113,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
 | 
				
			||||||
		if !options.SignOutRequire && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) &&
 | 
							if !options.SignOutRequire && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) &&
 | 
				
			||||||
			len(ctx.GetCookie(setting.CookieUserName)) > 0 {
 | 
								len(ctx.GetCookie(setting.CookieUserName)) > 0 {
 | 
				
			||||||
			ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
 | 
								ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl)
 | 
				
			||||||
			ctx.Redirect(setting.AppSubUrl + ctx.Req.RequestURI)
 | 
								ctx.Redirect(setting.AppSubUrl + "/user/login")
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if options.AdminRequire {
 | 
							if options.AdminRequire {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1 @@
 | 
				
			||||||
0.8.53.0303
 | 
					0.8.54.0304
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue