mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Refactor CSRF token (#32216)
This commit is contained in:
		| @@ -462,7 +462,7 @@ func doBranchProtectPRMerge(baseCtx *APITestContext, dstPath string) func(t *tes | ||||
| func doProtectBranch(ctx APITestContext, branch, userToWhitelistPush, userToWhitelistForcePush, unprotectedFilePatterns string) func(t *testing.T) { | ||||
| 	// We are going to just use the owner to set the protection. | ||||
| 	return func(t *testing.T) { | ||||
| 		csrf := GetCSRF(t, ctx.Session, fmt.Sprintf("/%s/%s/settings/branches", url.PathEscape(ctx.Username), url.PathEscape(ctx.Reponame))) | ||||
| 		csrf := GetUserCSRFToken(t, ctx.Session) | ||||
|  | ||||
| 		formData := map[string]string{ | ||||
| 			"_csrf":                     csrf, | ||||
| @@ -644,7 +644,7 @@ func doPushCreate(ctx APITestContext, u *url.URL) func(t *testing.T) { | ||||
|  | ||||
| func doBranchDelete(ctx APITestContext, owner, repo, branch string) func(*testing.T) { | ||||
| 	return func(t *testing.T) { | ||||
| 		csrf := GetCSRF(t, ctx.Session, fmt.Sprintf("/%s/%s/branches", url.PathEscape(owner), url.PathEscape(repo))) | ||||
| 		csrf := GetUserCSRFToken(t, ctx.Session) | ||||
|  | ||||
| 		req := NewRequestWithValues(t, "POST", fmt.Sprintf("/%s/%s/branches/delete?name=%s", url.PathEscape(owner), url.PathEscape(repo), url.QueryEscape(branch)), map[string]string{ | ||||
| 			"_csrf": csrf, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user