1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-19 07:02:51 +00:00

Slight redesign of the login form

This commit is contained in:
bouncepaw 2021-02-23 19:36:12 +05:00
parent c83710f155
commit 170240177e
2 changed files with 110 additions and 100 deletions

View File

@ -1,28 +1,30 @@
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
{% func LoginHTML() %}
<div class="layout">
<main class="main-width">
<section>
{% if user.AuthUsed %}
<h1>Login</h1>
<form method="post" action="/login-data" id="login-form" enctype="multipart/form-data">
<p>Use the data you were given by an administrator.</p>
<fieldset>
<legend>Username</legend>
<input type="text" required autofocus name="username" autocomplete="on">
<form class="modal" method="post" action="/login-data" id="login-form" enctype="multipart/form-data" autocomplete="on">
<fieldset class="modal__fieldset">
<legend class="modal__title">Log in to {%s util.SiteName %}</legend>
<p>Use the data you were given by an administrator.</p>
<label for="login-form__username">Username</label>
<br>
<input type="text" required autofocus id="login-form__username" name="username" autocomplete="username">
<br>
<label for="login-form__password">Password</label>
<br>
<input type="password" required name="password" autocomplete="current-password">
<p>By submitting this form you give this wiki a permission to store cookies in your browser. It lets the engine associate your edits with you. You will stay logged in until you log out.</p>
<input class="modal__action modal__submit" type="submit">
<a class="modal__action modal__cancel" href="/">Cancel</a>
</fieldset>
<fieldset>
<legend>Password</legend>
<input type="password" required name="password" autocomplete="on">
</fieldset>
<p>By submitting this form you give this wiki a permission to store cookies in your browser. It lets the engine associate your edits with you. You will stay logged in until you log out.</p>
<input type="submit">
<a href="/">Cancel</a>
</form>
{% else %}
<p>Administrator of this wiki have not configured any authorization method. You can make edits anonymously.</p>
<p><a href="/">← Go home</a></p>
<p>Administrators of this wiki have not configured any authorization method. You can make edits anonymously.</p>
<p><a class="modal__cancel" href="/">← Go home</a></p>
{% endif %}
</section>
</main>

View File

@ -7,218 +7,226 @@ package views
//line views/auth.qtpl:1
import "github.com/bouncepaw/mycorrhiza/user"
//line views/auth.qtpl:3
//line views/auth.qtpl:2
import "github.com/bouncepaw/mycorrhiza/util"
//line views/auth.qtpl:4
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line views/auth.qtpl:3
//line views/auth.qtpl:4
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line views/auth.qtpl:3
//line views/auth.qtpl:4
func StreamLoginHTML(qw422016 *qt422016.Writer) {
//line views/auth.qtpl:3
//line views/auth.qtpl:4
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<section>
`)
//line views/auth.qtpl:7
//line views/auth.qtpl:8
if user.AuthUsed {
//line views/auth.qtpl:7
//line views/auth.qtpl:8
qw422016.N().S(`
<h1>Login</h1>
<form method="post" action="/login-data" id="login-form" enctype="multipart/form-data">
<p>Use the data you were given by an administrator.</p>
<fieldset>
<legend>Username</legend>
<input type="text" required autofocus name="username" autocomplete="on">
<form class="modal" method="post" action="/login-data" id="login-form" enctype="multipart/form-data" autocomplete="on">
<fieldset class="modal__fieldset">
<legend class="modal__title">Log in to `)
//line views/auth.qtpl:11
qw422016.E().S(util.SiteName)
//line views/auth.qtpl:11
qw422016.N().S(`</legend>
<p>Use the data you were given by an administrator.</p>
<label for="login-form__username">Username</label>
<br>
<input type="text" required autofocus id="login-form__username" name="username" autocomplete="username">
<br>
<label for="login-form__password">Password</label>
<br>
<input type="password" required name="password" autocomplete="current-password">
<p>By submitting this form you give this wiki a permission to store cookies in your browser. It lets the engine associate your edits with you. You will stay logged in until you log out.</p>
<input class="modal__action modal__submit" type="submit">
<a class="modal__action modal__cancel" href="/">Cancel</a>
</fieldset>
<fieldset>
<legend>Password</legend>
<input type="password" required name="password" autocomplete="on">
</fieldset>
<p>By submitting this form you give this wiki a permission to store cookies in your browser. It lets the engine associate your edits with you. You will stay logged in until you log out.</p>
<input type="submit">
<a href="/">Cancel</a>
</form>
`)
//line views/auth.qtpl:23
//line views/auth.qtpl:25
} else {
//line views/auth.qtpl:23
//line views/auth.qtpl:25
qw422016.N().S(`
<p>Administrator of this wiki have not configured any authorization method. You can make edits anonymously.</p>
<p><a href="/"> Go home</a></p>
<p>Administrators of this wiki have not configured any authorization method. You can make edits anonymously.</p>
<p><a class="modal__cancel" href="/"> Go home</a></p>
`)
//line views/auth.qtpl:26
//line views/auth.qtpl:28
}
//line views/auth.qtpl:26
//line views/auth.qtpl:28
qw422016.N().S(`
</section>
</main>
</div>
`)
//line views/auth.qtpl:30
//line views/auth.qtpl:32
}
//line views/auth.qtpl:30
//line views/auth.qtpl:32
func WriteLoginHTML(qq422016 qtio422016.Writer) {
//line views/auth.qtpl:30
//line views/auth.qtpl:32
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:30
//line views/auth.qtpl:32
StreamLoginHTML(qw422016)
//line views/auth.qtpl:30
//line views/auth.qtpl:32
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:30
//line views/auth.qtpl:32
}
//line views/auth.qtpl:30
//line views/auth.qtpl:32
func LoginHTML() string {
//line views/auth.qtpl:30
//line views/auth.qtpl:32
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:30
//line views/auth.qtpl:32
WriteLoginHTML(qb422016)
//line views/auth.qtpl:30
//line views/auth.qtpl:32
qs422016 := string(qb422016.B)
//line views/auth.qtpl:30
//line views/auth.qtpl:32
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:30
//line views/auth.qtpl:32
return qs422016
//line views/auth.qtpl:30
//line views/auth.qtpl:32
}
//line views/auth.qtpl:32
//line views/auth.qtpl:34
func StreamLoginErrorHTML(qw422016 *qt422016.Writer, err string) {
//line views/auth.qtpl:32
//line views/auth.qtpl:34
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<section>
`)
//line views/auth.qtpl:36
//line views/auth.qtpl:38
switch err {
//line views/auth.qtpl:37
//line views/auth.qtpl:39
case "unknown username":
//line views/auth.qtpl:37
//line views/auth.qtpl:39
qw422016.N().S(`
<p class="error">Unknown username.</p>
`)
//line views/auth.qtpl:39
//line views/auth.qtpl:41
case "wrong password":
//line views/auth.qtpl:39
//line views/auth.qtpl:41
qw422016.N().S(`
<p class="error">Wrong password.</p>
`)
//line views/auth.qtpl:41
//line views/auth.qtpl:43
default:
//line views/auth.qtpl:41
//line views/auth.qtpl:43
qw422016.N().S(`
<p class="error">`)
//line views/auth.qtpl:42
//line views/auth.qtpl:44
qw422016.E().S(err)
//line views/auth.qtpl:42
//line views/auth.qtpl:44
qw422016.N().S(`</p>
`)
//line views/auth.qtpl:43
//line views/auth.qtpl:45
}
//line views/auth.qtpl:43
//line views/auth.qtpl:45
qw422016.N().S(`
<p><a href="/login"> Try again</a></p>
</section>
</main>
</div>
`)
//line views/auth.qtpl:48
//line views/auth.qtpl:50
}
//line views/auth.qtpl:48
//line views/auth.qtpl:50
func WriteLoginErrorHTML(qq422016 qtio422016.Writer, err string) {
//line views/auth.qtpl:48
//line views/auth.qtpl:50
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:48
//line views/auth.qtpl:50
StreamLoginErrorHTML(qw422016, err)
//line views/auth.qtpl:48
//line views/auth.qtpl:50
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:48
//line views/auth.qtpl:50
}
//line views/auth.qtpl:48
//line views/auth.qtpl:50
func LoginErrorHTML(err string) string {
//line views/auth.qtpl:48
//line views/auth.qtpl:50
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:48
//line views/auth.qtpl:50
WriteLoginErrorHTML(qb422016, err)
//line views/auth.qtpl:48
//line views/auth.qtpl:50
qs422016 := string(qb422016.B)
//line views/auth.qtpl:48
//line views/auth.qtpl:50
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:48
//line views/auth.qtpl:50
return qs422016
//line views/auth.qtpl:48
//line views/auth.qtpl:50
}
//line views/auth.qtpl:50
//line views/auth.qtpl:52
func StreamLogoutHTML(qw422016 *qt422016.Writer, can bool) {
//line views/auth.qtpl:50
//line views/auth.qtpl:52
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<section>
`)
//line views/auth.qtpl:54
//line views/auth.qtpl:56
if can {
//line views/auth.qtpl:54
//line views/auth.qtpl:56
qw422016.N().S(`
<h1>Log out?</h1>
<p><a href="/logout-confirm"><strong>Confirm</strong></a></p>
<p><a href="/">Cancel</a></p>
`)
//line views/auth.qtpl:58
//line views/auth.qtpl:60
} else {
//line views/auth.qtpl:58
//line views/auth.qtpl:60
qw422016.N().S(`
<p>You cannot log out because you are not logged in.</p>
<p><a href="/login">Login</a></p>
<p><a href="/login"> Home</a></p>
`)
//line views/auth.qtpl:62
//line views/auth.qtpl:64
}
//line views/auth.qtpl:62
//line views/auth.qtpl:64
qw422016.N().S(`
</section>
</main>
</div>
`)
//line views/auth.qtpl:66
//line views/auth.qtpl:68
}
//line views/auth.qtpl:66
//line views/auth.qtpl:68
func WriteLogoutHTML(qq422016 qtio422016.Writer, can bool) {
//line views/auth.qtpl:66
//line views/auth.qtpl:68
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:66
//line views/auth.qtpl:68
StreamLogoutHTML(qw422016, can)
//line views/auth.qtpl:66
//line views/auth.qtpl:68
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:66
//line views/auth.qtpl:68
}
//line views/auth.qtpl:66
//line views/auth.qtpl:68
func LogoutHTML(can bool) string {
//line views/auth.qtpl:66
//line views/auth.qtpl:68
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:66
//line views/auth.qtpl:68
WriteLogoutHTML(qb422016, can)
//line views/auth.qtpl:66
//line views/auth.qtpl:68
qs422016 := string(qb422016.B)
//line views/auth.qtpl:66
//line views/auth.qtpl:68
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:66
//line views/auth.qtpl:68
return qs422016
//line views/auth.qtpl:66
//line views/auth.qtpl:68
}