all repos — flounder @ b78509c99c42f8e034d677322eb7ffa727ee7de1

A small site builder for the Gemini protocol

Fix nested impersonation
alex wennerberg alex@alexwennerberg.com
Sun, 27 Dec 2020 12:11:24 -0800
commit

b78509c99c42f8e034d677322eb7ffa727ee7de1

parent

7dbd33126b29caac5ffbfd9fa34ead2afb2a406f

1 files changed, 5 insertions(+), 0 deletions(-)

jump to
M http.gohttp.go

@@ -654,6 +654,11 @@ var err error

if action == "activate" { err = activateUser(userName) } else if action == "impersonate" { + if user.ImpersonatingUser != "" { + // Don't allow nested impersonation + renderError(w, "Cannot nest impersonation, log out from impersonated user first.", 400) + return + } session, _ := SessionStore.Get(r, "cookie-session") session.Values["auth_user"] = userName session.Values["impersonating_user"] = user.Username