From d8f4f40f528168b13b669eca22582458ea8b3e24 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Fri, 9 Jul 2021 16:47:50 +0500 Subject: [PATCH] Implement the lock page It is unused now, you can take a look at it on /lock --- static/default.css | 29 +++++++++++++++++++++ views/auth.qtpl | 34 +++++++++++++++++++++++- views/auth.qtpl.go | 65 +++++++++++++++++++++++++++++++++++++++++++++- web/auth.go | 5 ++++ 4 files changed, 131 insertions(+), 2 deletions(-) diff --git a/static/default.css b/static/default.css index 1d37b1b..3928611 100644 --- a/static/default.css +++ b/static/default.css @@ -553,6 +553,35 @@ kbd { font-weight: bold; } +/* + * The lock page + */ +.locked-notice { + background-color: transparent; + display: flex; + justify-content: center; +} + +.locked-notice__message { + max-width: 30rem; + display: flex; + flex-direction: column; + align-items: center; +} + +.locked-notice__lock { + font-size: 8rem; + margin: 0; +} + +.locked-notice__title { + margin: 0 0 1rem 0; +} + +.locked-notice__login-form input { + margin-bottom: 1rem; +} + /* * To-do lists */ diff --git a/views/auth.qtpl b/views/auth.qtpl index 649fd82..a952635 100644 --- a/views/auth.qtpl +++ b/views/auth.qtpl @@ -57,7 +57,7 @@ {% else %}

Authentication is disabled. You can make edits anonymously.

-

← Go home

+

← Go home

{% endif %} @@ -99,3 +99,35 @@ {% endfunc %} + +{% func LockHTML() %} + + + + + + 🔒 Locked + + + + +
+
+

🔒

+

Locked

+ +
+
+ + +{% endfunc %} \ No newline at end of file diff --git a/views/auth.qtpl.go b/views/auth.qtpl.go index 7fffb8a..8b0658a 100644 --- a/views/auth.qtpl.go +++ b/views/auth.qtpl.go @@ -161,7 +161,7 @@ func StreamLoginHTML(qw422016 *qt422016.Writer) { //line views/auth.qtpl:58 qw422016.N().S(`

Authentication is disabled. You can make edits anonymously.

-

← Go home

+

← Go home

`) //line views/auth.qtpl:61 } @@ -330,3 +330,66 @@ func LogoutHTML(can bool) string { return qs422016 //line views/auth.qtpl:101 } + +//line views/auth.qtpl:103 +func StreamLockHTML(qw422016 *qt422016.Writer) { +//line views/auth.qtpl:103 + qw422016.N().S(` + + + + + + 🔒 Locked + + + + +
+
+

🔒

+

Locked

+ +
+
+ + +`) +//line views/auth.qtpl:133 +} + +//line views/auth.qtpl:133 +func WriteLockHTML(qq422016 qtio422016.Writer) { +//line views/auth.qtpl:133 + qw422016 := qt422016.AcquireWriter(qq422016) +//line views/auth.qtpl:133 + StreamLockHTML(qw422016) +//line views/auth.qtpl:133 + qt422016.ReleaseWriter(qw422016) +//line views/auth.qtpl:133 +} + +//line views/auth.qtpl:133 +func LockHTML() string { +//line views/auth.qtpl:133 + qb422016 := qt422016.AcquireByteBuffer() +//line views/auth.qtpl:133 + WriteLockHTML(qb422016) +//line views/auth.qtpl:133 + qs422016 := string(qb422016.B) +//line views/auth.qtpl:133 + qt422016.ReleaseByteBuffer(qb422016) +//line views/auth.qtpl:133 + return qs422016 +//line views/auth.qtpl:133 +} diff --git a/web/auth.go b/web/auth.go index 3e65f83..7b5fba8 100644 --- a/web/auth.go +++ b/web/auth.go @@ -14,6 +14,7 @@ import ( ) func initAuth() { + http.HandleFunc("/lock", handlerLock) if !cfg.UseAuth { return } @@ -26,6 +27,10 @@ func initAuth() { http.HandleFunc("/logout-confirm", handlerLogoutConfirm) } +func handlerLock(w http.ResponseWriter, rq *http.Request) { + io.WriteString(w, views.LockHTML()) +} + // handlerRegister both displays the register form (GET) and registers users (POST). func handlerRegister(w http.ResponseWriter, rq *http.Request) { util.PrepareRq(rq)