1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/views/auth.qtpl.go

333 lines
8.8 KiB
Go
Raw Normal View History

2020-11-14 13:03:06 +00:00
// Code generated by qtc from "auth.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line views/auth.qtpl:1
package views
2020-11-14 13:03:06 +00:00
//line views/auth.qtpl:1
import "net/http"
2020-11-14 13:03:06 +00:00
2021-02-23 14:36:12 +00:00
//line views/auth.qtpl:2
import "github.com/bouncepaw/mycorrhiza/user"
//line views/auth.qtpl:3
import "github.com/bouncepaw/mycorrhiza/cfg"
2021-02-23 14:36:12 +00:00
//line views/auth.qtpl:5
2020-11-14 13:03:06 +00:00
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line views/auth.qtpl:5
2020-11-14 13:03:06 +00:00
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line views/auth.qtpl:5
func StreamRegisterHTML(qw422016 *qt422016.Writer, rq *http.Request) {
//line views/auth.qtpl:5
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<section>
`)
//line views/auth.qtpl:9
if cfg.UseRegistration {
//line views/auth.qtpl:9
qw422016.N().S(`
<form class="modal" method="post" action="/register?`)
//line views/auth.qtpl:10
qw422016.E().S(rq.URL.RawQuery)
//line views/auth.qtpl:10
qw422016.N().S(`" id="register-form" enctype="multipart/form-data" autocomplete="off">
<fieldset class="modal__fieldset">
<legend class="modal__title">Register to `)
//line views/auth.qtpl:12
qw422016.E().S(cfg.WikiName)
//line views/auth.qtpl:12
qw422016.N().S(`</legend>
<label for="register-form__username">Username</label>
<br>
<input type="text" required autofocus id="login-form__username" name="username">
<br>
<label for="login-form__password">Password</label>
<br>
<input type="password" required name="password">
<p>The server stores your password in an encrypted form; even administrators cannot read it.</p>
<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>
</form>
`)
//line views/auth.qtpl:27
} else if cfg.UseFixedAuth {
//line views/auth.qtpl:27
qw422016.N().S(`
<p>Administrators have forbidden registration for this wiki. Administrators can make an account for you by hand; contact them.</p>
<p><a href="`)
//line views/auth.qtpl:29
qw422016.E().S(rq.URL.RawQuery)
//line views/auth.qtpl:29
qw422016.N().S(`"> Go back</a></p>
`)
//line views/auth.qtpl:30
} else {
//line views/auth.qtpl:30
qw422016.N().S(`
<p>Administrators of this wiki have not configured any authorization method. You can make edits anonymously.</p>
<p><a href="`)
//line views/auth.qtpl:32
qw422016.E().S(rq.URL.RawQuery)
//line views/auth.qtpl:32
qw422016.N().S(`"> Go back</a></p>
`)
//line views/auth.qtpl:33
}
//line views/auth.qtpl:33
qw422016.N().S(`
</section>
</main>
</div>
`)
//line views/auth.qtpl:37
}
//line views/auth.qtpl:37
func WriteRegisterHTML(qq422016 qtio422016.Writer, rq *http.Request) {
//line views/auth.qtpl:37
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:37
StreamRegisterHTML(qw422016, rq)
//line views/auth.qtpl:37
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:37
}
//line views/auth.qtpl:37
func RegisterHTML(rq *http.Request) string {
//line views/auth.qtpl:37
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:37
WriteRegisterHTML(qb422016, rq)
//line views/auth.qtpl:37
qs422016 := string(qb422016.B)
//line views/auth.qtpl:37
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:37
return qs422016
//line views/auth.qtpl:37
}
//line views/auth.qtpl:39
2020-11-14 13:03:06 +00:00
func StreamLoginHTML(qw422016 *qt422016.Writer) {
//line views/auth.qtpl:39
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
<div class="layout">
<main class="main-width">
2020-11-14 13:03:06 +00:00
<section>
`)
//line views/auth.qtpl:43
2020-11-14 13:03:06 +00:00
if user.AuthUsed {
//line views/auth.qtpl:43
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-02-23 14:36:12 +00:00
<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:46
qw422016.E().S(cfg.WikiName)
//line views/auth.qtpl:46
2021-02-23 14:36:12 +00:00
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>
2020-11-14 13:03:06 +00:00
</fieldset>
</form>
`)
//line views/auth.qtpl:60
2020-11-14 13:03:06 +00:00
} else {
//line views/auth.qtpl:60
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-02-23 14:36:12 +00:00
<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>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:63
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:63
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
</section>
</main>
2021-01-26 05:41:57 +00:00
</div>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
func WriteLoginHTML(qq422016 qtio422016.Writer) {
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
StreamLoginHTML(qw422016)
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
func LoginHTML() string {
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
WriteLoginHTML(qb422016)
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
qs422016 := string(qb422016.B)
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
return qs422016
//line views/auth.qtpl:67
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:69
2020-11-14 13:03:06 +00:00
func StreamLoginErrorHTML(qw422016 *qt422016.Writer, err string) {
//line views/auth.qtpl:69
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
<div class="layout">
<main class="main-width">
2020-11-14 13:03:06 +00:00
<section>
`)
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
switch err {
//line views/auth.qtpl:74
2020-11-14 13:03:06 +00:00
case "unknown username":
//line views/auth.qtpl:74
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
<p class="error">Unknown username.</p>
`)
//line views/auth.qtpl:76
2020-11-14 13:03:06 +00:00
case "wrong password":
//line views/auth.qtpl:76
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
<p class="error">Wrong password.</p>
`)
//line views/auth.qtpl:78
2020-11-14 13:03:06 +00:00
default:
//line views/auth.qtpl:78
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
<p class="error">`)
//line views/auth.qtpl:79
2020-11-14 13:03:06 +00:00
qw422016.E().S(err)
//line views/auth.qtpl:79
2020-11-14 13:03:06 +00:00
qw422016.N().S(`</p>
`)
//line views/auth.qtpl:80
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:80
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
<p><a href="/login"> Try again</a></p>
</section>
</main>
2021-01-26 05:41:57 +00:00
</div>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
func WriteLoginErrorHTML(qq422016 qtio422016.Writer, err string) {
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
StreamLoginErrorHTML(qw422016, err)
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
func LoginErrorHTML(err string) string {
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
WriteLoginErrorHTML(qb422016, err)
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
qs422016 := string(qb422016.B)
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
return qs422016
//line views/auth.qtpl:85
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:87
2020-11-14 13:03:06 +00:00
func StreamLogoutHTML(qw422016 *qt422016.Writer, can bool) {
//line views/auth.qtpl:87
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-01-26 05:41:57 +00:00
<div class="layout">
<main class="main-width">
2020-11-14 13:03:06 +00:00
<section>
`)
//line views/auth.qtpl:91
2020-11-14 13:03:06 +00:00
if can {
//line views/auth.qtpl:91
2020-11-14 13:03:06 +00:00
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:95
2020-11-14 13:03:06 +00:00
} else {
//line views/auth.qtpl:95
2020-11-14 13:03:06 +00:00
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:99
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
</section>
</main>
2021-01-26 05:41:57 +00:00
</div>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
func WriteLogoutHTML(qq422016 qtio422016.Writer, can bool) {
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
StreamLogoutHTML(qw422016, can)
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
func LogoutHTML(can bool) string {
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
WriteLogoutHTML(qb422016, can)
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
qs422016 := string(qb422016.B)
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
return qs422016
//line views/auth.qtpl:103
2020-11-14 13:03:06 +00:00
}