From 911da7368fd2466ffe2f6a3cc2d3dad79218d524 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Jul 2021 20:18:08 +0000 Subject: [PATCH] renew captcha code --- src/users_api.go | 6 +++++- ui/index.html | 44 +++++++++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/users_api.go b/src/users_api.go index 0dc1fec..7eb3768 100644 --- a/src/users_api.go +++ b/src/users_api.go @@ -347,7 +347,11 @@ func (e mainEnv) userPrelogin(w http.ResponseWriter, r *http.Request, ps httprou //notifyURL := e.conf.Notification.NotificationURL //notifyBadLogin(notifyURL, mode, identity) e.pluginUserLookup(identity) - returnError(w, r, "record not found", 405, errors.New("record not found"), event) + //returnError(w, r, "record not found", 405, errors.New("record not found"), event) + captcha, _ := generateCaptcha() + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(403) + fmt.Fprintf(w, `{"status":"error","result":"record not found","captchaurl":"%s"}`, captcha) return } fmt.Println("user record not found, still returning ok status") diff --git a/ui/index.html b/ui/index.html index 24fc7ec..c7a4132 100644 --- a/ui/index.html +++ b/ui/index.html @@ -59,15 +59,15 @@ if (conf["custom_css_link"]) { placeholder="Enter token...">
- +
-
- +
@@ -93,6 +93,8 @@ if (conf["custom_css_link"]) {