From 02f4443fb07875bf86b5a2e22d4709c7b59fc6d3 Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Mon, 27 Jan 2025 18:58:50 +0000 Subject: [PATCH] Remove testAuthSources --- server/login.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/server/login.go b/server/login.go index a3c6f8c..c6b04ce 100644 --- a/server/login.go +++ b/server/login.go @@ -46,25 +46,6 @@ func getUserLoginName(req *http.Request) string { return originUrl.Query().Get("login_name") } -func (h *httpServer) testAuthSources(req *http.Request, user *database.User, factor auth.State) map[string]bool { - authSource := make(map[string]bool) - data := make(map[string]any) - for _, i := range h.authSources { - // ignore not-supported factors - if i.AccessState() != factor { - continue - } - form, ok := i.(auth.Form) - if !ok { - continue - } - err := form.RenderTemplate(authContext.NewTemplateContext(req, user)) - authSource[i.Name()] = err == nil - clear(data) - } - return authSource -} - func (h *httpServer) getAuthWithState(state auth.State) auth.Provider { for _, i := range h.authSources { if i.AccessState() == state { @@ -111,14 +92,11 @@ func (h *httpServer) loginGet(rw http.ResponseWriter, req *http.Request, _ httpr return } - fmt.Printf("%#v\n", h.testAuthSources(req, userPtr, auth.StateBasic)) - web.RenderPageTemplate(rw, "login-memory", map[string]any{ "ServiceName": h.conf.ServiceName, "LoginName": cookie.Value, "Redirect": req.URL.Query().Get("redirect"), "Source": "start", - "Auth": h.testAuthSources(req, userPtr, auth.StateBasic), }) return }