mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	support URL param to token, but still restrict to APIs
This commit is contained in:
		@@ -32,6 +32,7 @@ func SignedInID(ctx *macaron.Context, sess session.Store) int64 {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Check access token.
 | 
						// Check access token.
 | 
				
			||||||
 | 
						if IsAPIPath(ctx.Req.URL.Path) {
 | 
				
			||||||
		tokenSHA := ctx.Query("token")
 | 
							tokenSHA := ctx.Query("token")
 | 
				
			||||||
		if len(tokenSHA) == 0 {
 | 
							if len(tokenSHA) == 0 {
 | 
				
			||||||
			// Well, check with header again.
 | 
								// Well, check with header again.
 | 
				
			||||||
@@ -59,6 +60,7 @@ func SignedInID(ctx *macaron.Context, sess session.Store) int64 {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			return t.UID
 | 
								return t.UID
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uid := sess.Get("uid")
 | 
						uid := sess.Get("uid")
 | 
				
			||||||
	if uid == nil {
 | 
						if uid == nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user