Fix sign in request
This commit is contained in:
parent
ae388d7cad
commit
3984afc60b
1 changed files with 12 additions and 2 deletions
14
web.go
14
web.go
|
@ -17,6 +17,16 @@ import (
|
|||
//go:embed www
|
||||
var wwwFS embed.FS
|
||||
|
||||
var signInPage = []byte(`
|
||||
<body onload="askToSignIn()">
|
||||
<script type="text/javascript">
|
||||
function askToSignIn() {
|
||||
MA.askToSignIn();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
`)
|
||||
|
||||
var pages = map[string]http.HandlerFunc{
|
||||
"community": handleCommunity,
|
||||
"sessions": handleSessions,
|
||||
|
@ -39,8 +49,8 @@ func authenticateUser(w http.ResponseWriter, r *http.Request) *account {
|
|||
return nil
|
||||
} else if acc == nil {
|
||||
w.Header().Set("x-MediNET", "signin")
|
||||
w.Header().Set("Location", "/signin")
|
||||
w.WriteHeader(http.StatusTemporaryRedirect)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write(signInPage)
|
||||
logDebugf("Asking to sign in %s %q", key, html.EscapeString(r.URL.RequestURI()))
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue