@@ 120,13 120,6 @@ func authForUsername(ctx context.Context, username string) (*AuthContext, error)
if err := LookupUser(ctx, username, &auth); err != nil {
return nil, err
}
-
- if auth.UserType == USER_TYPE_SUSPENDED {
- return nil, fmt.Errorf(
- "Account suspended with the following notice: %s\nContact support",
- *auth.SuspensionNotice)
- }
-
return &auth, nil
}
@@ 215,6 208,14 @@ func cookieAuth(cookie *http.Cookie, w http.ResponseWriter,
return
}
+ if auth.UserType == USER_TYPE_SUSPENDED {
+ authError(w, fmt.Sprintf(
+ "Account suspended with the following notice: %s\nContact support",
+ *auth.SuspensionNotice),
+ http.StatusForbidden)
+ return
+ }
+
auth.AuthMethod = AUTH_COOKIE
ctx := context.WithValue(r.Context(), userCtxKey, auth)