only assign auto-admin when sign up by web

This commit is contained in:
Unknwon 2015-08-19 04:58:45 +08:00
parent 928d9fc1d4
commit 47ac579f09
4 changed files with 14 additions and 12 deletions

View file

@ -80,7 +80,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return
}
if !options.SignOutRequire && !options.DisableCsrf && ctx.Req.Method == "POST" {
if !options.SignOutRequire && !options.DisableCsrf && ctx.Req.Method == "POST" && !auth.IsAPIPath(ctx.Req.URL.Path) {
csrf.Validate(ctx.Context, ctx.csrf)
if ctx.Written() {
return