Success not red, go fmt

This commit is contained in:
Neale Pickett 2023-02-18 17:45:44 -07:00
parent 53d04746b3
commit 04e3352e6a
2 changed files with 6 additions and 2 deletions

View File

@ -64,7 +64,7 @@ func rootHandler(w http.ResponseWriter, req *http.Request) {
status = "succeeded" status = "succeeded"
w.Header().Set("X-Simpleauth-Username", username) w.Header().Set("X-Simpleauth-Username", username)
if !login { if !login {
// This is the only time simpleauth returns 200 // This is the only time simpleauth returns 200
// That will cause Caddy to proceed with the original request // That will cause Caddy to proceed with the original request
http.Error(w, "Success", http.StatusOK) http.Error(w, "Success", http.StatusOK)

View File

@ -21,6 +21,9 @@
function error(msg) { function error(msg) {
document.querySelector("#error").textContent = msg document.querySelector("#error").textContent = msg
} }
function message(msg) {
document.querySelector("#message").textContent = msg
}
async function login(evt) { async function login(evt) {
evt.preventDefault() evt.preventDefault()
@ -51,7 +54,7 @@
} }
document.cookie = cookieStr // JavaScript butt-magic! document.cookie = cookieStr // JavaScript butt-magic!
location.reload() location.reload()
error("Success - your page should reload now") message("Logged In!")
return return
} }
error(req.statusText || "Authentication failed") error(req.statusText || "Authentication failed")
@ -72,5 +75,6 @@
<div><input type="submit" value="Log In"></div> <div><input type="submit" value="Log In"></div>
</form> </form>
<div id="error"></div> <div id="error"></div>
<div id="message"></div>
</body> </body>
</html> </html>