1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-16 15:00:26 +00:00
mycorrhiza/views/auth.qtpl.go

781 lines
20 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 "sort"
2021-02-23 14:36:12 +00:00
2021-09-06 17:46:34 +00:00
//line views/auth.qtpl:3
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/auth.qtpl:4
2021-09-06 17:46:34 +00:00
import "github.com/bouncepaw/mycorrhiza/l18n"
//line views/auth.qtpl:5
import "github.com/bouncepaw/mycorrhiza/user"
//line views/auth.qtpl:7
2020-11-14 13:03:06 +00:00
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line views/auth.qtpl:7
2020-11-14 13:03:06 +00:00
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line views/auth.qtpl:7
2022-03-20 21:24:40 +00:00
func StreamRegister(qw422016 *qt422016.Writer, rq *http.Request) {
//line views/auth.qtpl:7
2021-09-06 17:46:34 +00:00
qw422016.N().S(`
`)
//line views/auth.qtpl:9
2021-09-06 17:46:34 +00:00
lc := l18n.FromRequest(rq)
//line views/auth.qtpl:10
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<section>
`)
//line views/auth.qtpl:14
if cfg.AllowRegistration {
//line views/auth.qtpl:14
qw422016.N().S(`
<form class="modal" method="post" action="/register?`)
//line views/auth.qtpl:15
qw422016.E().S(rq.URL.RawQuery)
//line views/auth.qtpl:15
qw422016.N().S(`" id="register-form" enctype="multipart/form-data" autocomplete="off">
<fieldset class="modal__fieldset">
2021-09-06 17:46:34 +00:00
<legend class="modal__title">`)
//line views/auth.qtpl:17
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.register_header", &l18n.Replacements{"name": cfg.WikiName}))
//line views/auth.qtpl:17
qw422016.N().S(`</legend>
2021-09-06 17:46:34 +00:00
<label for="register-form__username">`)
//line views/auth.qtpl:19
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.username"))
//line views/auth.qtpl:19
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</label>
<br>
<input type="text" required autofocus id="login-form__username" name="username">
<br>
2021-09-06 17:46:34 +00:00
<label for="login-form__password">`)
//line views/auth.qtpl:23
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.password"))
//line views/auth.qtpl:23
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</label>
<br>
<input type="password" required name="password">
2021-09-06 17:46:34 +00:00
<p>`)
//line views/auth.qtpl:26
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.password_tip"))
//line views/auth.qtpl:26
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
<p>`)
//line views/auth.qtpl:27
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.cookie_tip"))
//line views/auth.qtpl:27
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
<button class="btn" type="submit" value="Register">`)
//line views/auth.qtpl:28
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.register_button"))
//line views/auth.qtpl:28
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</button>
<a class="btn btn_weak" href="/`)
//line views/auth.qtpl:29
qw422016.E().S(rq.URL.RawQuery)
//line views/auth.qtpl:29
2021-09-06 17:46:34 +00:00
qw422016.N().S(`">`)
//line views/auth.qtpl:29
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("ui.cancel"))
//line views/auth.qtpl:29
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a>
</fieldset>
</form>
2021-07-14 19:51:55 +00:00
`)
//line views/auth.qtpl:32
2022-03-20 21:24:40 +00:00
streamtelegramWidget(qw422016, lc)
//line views/auth.qtpl:32
qw422016.N().S(`
2021-07-14 19:51:55 +00:00
`)
//line views/auth.qtpl:33
2021-07-14 19:51:55 +00:00
} else if cfg.UseAuth {
//line views/auth.qtpl:33
2021-07-14 19:51:55 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p>`)
//line views/auth.qtpl:34
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.noregister"))
//line views/auth.qtpl:34
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
<p><a href="/`)
//line views/auth.qtpl:35
qw422016.E().S(rq.URL.RawQuery)
//line views/auth.qtpl:35
2021-09-06 17:46:34 +00:00
qw422016.N().S(`">← `)
//line views/auth.qtpl:35
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.go_back"))
//line views/auth.qtpl:35
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a></p>
`)
//line views/auth.qtpl:36
} else {
//line views/auth.qtpl:36
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p>`)
//line views/auth.qtpl:37
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.noauth"))
//line views/auth.qtpl:37
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
<p><a href="/`)
//line views/auth.qtpl:38
qw422016.E().S(rq.URL.RawQuery)
//line views/auth.qtpl:38
2021-09-06 17:46:34 +00:00
qw422016.N().S(`">← `)
//line views/auth.qtpl:38
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.go_back"))
//line views/auth.qtpl:38
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a></p>
`)
//line views/auth.qtpl:39
}
//line views/auth.qtpl:39
qw422016.N().S(`
</section>
</main>
</div>
`)
//line views/auth.qtpl:43
}
//line views/auth.qtpl:43
2022-03-20 21:24:40 +00:00
func WriteRegister(qq422016 qtio422016.Writer, rq *http.Request) {
//line views/auth.qtpl:43
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:43
2022-03-20 21:24:40 +00:00
StreamRegister(qw422016, rq)
//line views/auth.qtpl:43
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:43
}
//line views/auth.qtpl:43
2022-03-20 21:24:40 +00:00
func Register(rq *http.Request) string {
//line views/auth.qtpl:43
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:43
2022-03-20 21:24:40 +00:00
WriteRegister(qb422016, rq)
//line views/auth.qtpl:43
qs422016 := string(qb422016.B)
//line views/auth.qtpl:43
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:43
return qs422016
//line views/auth.qtpl:43
}
//line views/auth.qtpl:45
2022-03-20 21:24:40 +00:00
func StreamLogin(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:45
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:49
if cfg.UseAuth {
//line views/auth.qtpl:49
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
<form class="modal" method="post" action="/login" id="login-form" enctype="multipart/form-data" autocomplete="on">
2021-02-23 14:36:12 +00:00
<fieldset class="modal__fieldset">
2021-09-06 17:46:34 +00:00
<legend class="modal__title">`)
//line views/auth.qtpl:52
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.login_header", &l18n.Replacements{"name": cfg.WikiName}))
//line views/auth.qtpl:52
2021-02-23 14:36:12 +00:00
qw422016.N().S(`</legend>
2021-09-06 17:46:34 +00:00
<label for="login-form__username">`)
//line views/auth.qtpl:53
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.username"))
//line views/auth.qtpl:53
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</label>
2021-02-23 14:36:12 +00:00
<br>
<input type="text" required autofocus id="login-form__username" name="username" autocomplete="username">
<br>
2021-09-06 17:46:34 +00:00
<label for="login-form__password">`)
//line views/auth.qtpl:57
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.password"))
//line views/auth.qtpl:57
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</label>
2021-02-23 14:36:12 +00:00
<br>
<input type="password" required name="password" autocomplete="current-password">
2021-09-06 17:46:34 +00:00
<p>`)
//line views/auth.qtpl:60
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.cookie_tip"))
//line views/auth.qtpl:60
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
<button class="btn" type="submit" value="Log in">`)
//line views/auth.qtpl:61
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.login_button"))
//line views/auth.qtpl:61
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</button>
<a class="btn btn_weak" href="/">`)
//line views/auth.qtpl:62
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("ui.cancel"))
//line views/auth.qtpl:62
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a>
2020-11-14 13:03:06 +00:00
</fieldset>
</form>
2021-07-14 19:51:55 +00:00
`)
//line views/auth.qtpl:65
2022-03-20 21:24:40 +00:00
streamtelegramWidget(qw422016, lc)
//line views/auth.qtpl:65
2021-07-14 19:51:55 +00:00
qw422016.N().S(`
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:66
2020-11-14 13:03:06 +00:00
} else {
//line views/auth.qtpl:66
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p>`)
//line views/auth.qtpl:67
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.noauth"))
//line views/auth.qtpl:67
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
<p><a class="btn btn_weak" href="/"> `)
//line views/auth.qtpl:68
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.go_home"))
//line views/auth.qtpl:68
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a></p>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:69
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:69
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:73
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:73
2022-03-20 21:24:40 +00:00
func WriteLogin(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:73
2022-03-20 21:24:40 +00:00
StreamLogin(qw422016, lc)
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:73
2022-03-20 21:24:40 +00:00
func Login(lc *l18n.Localizer) string {
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:73
2022-03-20 21:24:40 +00:00
WriteLogin(qb422016, lc)
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
qs422016 := string(qb422016.B)
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
return qs422016
//line views/auth.qtpl:73
2020-11-14 13:03:06 +00:00
}
2021-07-14 19:51:55 +00:00
// Telegram auth widget was requested by Yogurt. As you can see, we don't offer user administrators control over it. Of course we don't.
//line views/auth.qtpl:76
2022-03-20 21:24:40 +00:00
func streamtelegramWidget(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:76
2021-07-14 19:51:55 +00:00
qw422016.N().S(`
`)
//line views/auth.qtpl:77
2021-07-14 19:51:55 +00:00
if cfg.TelegramEnabled {
//line views/auth.qtpl:77
2021-07-14 19:51:55 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p class="telegram-notice">`)
//line views/auth.qtpl:78
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.telegram_tip"))
//line views/auth.qtpl:78
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
2021-07-14 19:51:55 +00:00
<script async src="https://telegram.org/js/telegram-widget.js?15" data-telegram-login="`)
//line views/auth.qtpl:79
2021-07-14 19:51:55 +00:00
qw422016.E().S(cfg.TelegramBotName)
//line views/auth.qtpl:79
2021-07-14 19:51:55 +00:00
qw422016.N().S(`" data-size="medium" data-userpic="false" data-auth-url="`)
//line views/auth.qtpl:79
2021-07-14 19:51:55 +00:00
qw422016.E().S(cfg.URL)
//line views/auth.qtpl:79
2021-07-14 19:51:55 +00:00
qw422016.N().S(`/telegram-login"></script>
`)
//line views/auth.qtpl:80
2021-07-14 19:51:55 +00:00
}
//line views/auth.qtpl:80
2021-07-14 19:51:55 +00:00
qw422016.N().S(`
`)
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
}
//line views/auth.qtpl:81
2022-03-20 21:24:40 +00:00
func writetelegramWidget(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:81
2022-03-20 21:24:40 +00:00
streamtelegramWidget(qw422016, lc)
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
}
//line views/auth.qtpl:81
2022-03-20 21:24:40 +00:00
func telegramWidget(lc *l18n.Localizer) string {
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:81
2022-03-20 21:24:40 +00:00
writetelegramWidget(qb422016, lc)
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
qs422016 := string(qb422016.B)
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
return qs422016
//line views/auth.qtpl:81
2021-07-14 19:51:55 +00:00
}
//line views/auth.qtpl:83
2022-03-20 21:24:40 +00:00
func StreamLoginError(qw422016 *qt422016.Writer, err string, lc *l18n.Localizer) {
//line views/auth.qtpl:83
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:87
2021-07-14 20:04:52 +00:00
switch err {
//line views/auth.qtpl:88
2020-11-14 13:03:06 +00:00
case "unknown username":
//line views/auth.qtpl:88
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p class="error">`)
//line views/auth.qtpl:89
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.error_username"))
//line views/auth.qtpl:89
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:90
2020-11-14 13:03:06 +00:00
case "wrong password":
//line views/auth.qtpl:90
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p class="error">`)
//line views/auth.qtpl:91
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.error_password"))
//line views/auth.qtpl:91
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:92
2020-11-14 13:03:06 +00:00
default:
//line views/auth.qtpl:92
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
<p class="error">`)
//line views/auth.qtpl:93
2020-11-14 13:03:06 +00:00
qw422016.E().S(err)
//line views/auth.qtpl:93
2020-11-14 13:03:06 +00:00
qw422016.N().S(`</p>
`)
//line views/auth.qtpl:94
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:94
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p><a href="/login"> `)
//line views/auth.qtpl:95
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.try_again"))
//line views/auth.qtpl:95
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a></p>
2020-11-14 13:03:06 +00:00
</section>
</main>
2021-01-26 05:41:57 +00:00
</div>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:99
2022-03-20 21:24:40 +00:00
func WriteLoginError(qq422016 qtio422016.Writer, err string, lc *l18n.Localizer) {
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:99
2022-03-20 21:24:40 +00:00
StreamLoginError(qw422016, err, lc)
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:99
2022-03-20 21:24:40 +00:00
func LoginError(err string, lc *l18n.Localizer) string {
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:99
2022-03-20 21:24:40 +00:00
WriteLoginError(qb422016, err, lc)
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
qs422016 := string(qb422016.B)
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
return qs422016
//line views/auth.qtpl:99
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:101
2022-03-20 21:24:40 +00:00
func StreamLogout(qw422016 *qt422016.Writer, can bool, lc *l18n.Localizer) {
//line views/auth.qtpl:101
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:105
2020-11-14 13:03:06 +00:00
if can {
//line views/auth.qtpl:105
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<h1>`)
//line views/auth.qtpl:106
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.logout_header"))
//line views/auth.qtpl:106
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</h1>
<form method="POST" action="/logout">
<input class="btn btn_accent" type="submit" value="`)
//line views/auth.qtpl:108
qw422016.E().S(lc.Get("auth.logout_button"))
//line views/auth.qtpl:108
qw422016.N().S(`"/>
<a class="btn btn_weak" href="/">`)
//line views/auth.qtpl:109
qw422016.E().S(lc.Get("auth.go_home"))
//line views/auth.qtpl:109
qw422016.N().S(`</a>
</form>
`)
//line views/auth.qtpl:111
} else {
//line views/auth.qtpl:111
2020-11-14 13:03:06 +00:00
qw422016.N().S(`
2021-09-06 17:46:34 +00:00
<p>`)
//line views/auth.qtpl:112
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.logout_anon"))
//line views/auth.qtpl:112
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</p>
<p><a href="/login">`)
//line views/auth.qtpl:113
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.login_title"))
//line views/auth.qtpl:113
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a></p>
<p><a href="/"> `)
//line views/auth.qtpl:114
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.go_home"))
//line views/auth.qtpl:114
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</a></p>
2020-11-14 13:03:06 +00:00
`)
//line views/auth.qtpl:115
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:115
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:119
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:119
2022-03-20 21:24:40 +00:00
func WriteLogout(qq422016 qtio422016.Writer, can bool, lc *l18n.Localizer) {
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:119
2022-03-20 21:24:40 +00:00
StreamLogout(qw422016, can, lc)
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:119
2022-03-20 21:24:40 +00:00
func Logout(can bool, lc *l18n.Localizer) string {
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:119
2022-03-20 21:24:40 +00:00
WriteLogout(qb422016, can, lc)
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
qs422016 := string(qb422016.B)
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
return qs422016
//line views/auth.qtpl:119
2020-11-14 13:03:06 +00:00
}
//line views/auth.qtpl:121
2022-03-20 21:24:40 +00:00
func StreamLock(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:121
qw422016.N().S(`
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
2021-09-06 17:46:34 +00:00
<title>🔒 `)
//line views/auth.qtpl:127
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.lock_title"))
//line views/auth.qtpl:127
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</title>
<link rel="shortcut icon" href="/static/favicon.ico">
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<main class="locked-notice">
<section class="locked-notice__message">
<p class="locked-notice__lock">🔒</p>
2021-09-06 17:46:34 +00:00
<h1 class="locked-notice__title">`)
//line views/auth.qtpl:135
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.lock_title"))
//line views/auth.qtpl:135
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</h1>
<form class="locked-notice__login-form" method="post" action="/login" id="login-form" enctype="multipart/form-data" autocomplete="on">
2021-09-06 17:46:34 +00:00
<label for="login-form__username">`)
//line views/auth.qtpl:137
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.username"))
//line views/auth.qtpl:137
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</label>
<br>
<input type="text" required autofocus id="login-form__username" name="username" autocomplete="username">
<br>
2021-09-06 17:46:34 +00:00
<label for="login-form__password">`)
//line views/auth.qtpl:141
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.password"))
//line views/auth.qtpl:141
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</label>
<br>
<input type="password" required name="password" autocomplete="current-password">
<br>
2021-09-06 17:46:34 +00:00
<button class="btn" type="submit" value="Log in">`)
//line views/auth.qtpl:145
2021-09-06 17:46:34 +00:00
qw422016.E().S(lc.Get("auth.login_button"))
//line views/auth.qtpl:145
2021-09-06 17:46:34 +00:00
qw422016.N().S(`</button>
</form>
`)
//line views/auth.qtpl:147
2022-03-20 21:24:40 +00:00
streamtelegramWidget(qw422016, lc)
//line views/auth.qtpl:147
2021-07-24 11:09:39 +00:00
qw422016.N().S(`
</section>
</main>
</body>
</html>
`)
//line views/auth.qtpl:152
}
//line views/auth.qtpl:152
2022-03-20 21:24:40 +00:00
func WriteLock(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:152
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:152
2022-03-20 21:24:40 +00:00
StreamLock(qw422016, lc)
//line views/auth.qtpl:152
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:152
}
//line views/auth.qtpl:152
2022-03-20 21:24:40 +00:00
func Lock(lc *l18n.Localizer) string {
//line views/auth.qtpl:152
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:152
2022-03-20 21:24:40 +00:00
WriteLock(qb422016, lc)
//line views/auth.qtpl:152
qs422016 := string(qb422016.B)
//line views/auth.qtpl:152
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:152
return qs422016
//line views/auth.qtpl:152
}
//line views/auth.qtpl:155
var userListL10n = map[string]l10nEntry{
"heading": en("List of users").ru("Список пользователей"),
"administrators": en("Administrators").ru("Администраторы"),
"moderators": en("Moderators").ru("Модераторы"),
"editors": en("Editors").ru("Редакторы"),
}
//line views/auth.qtpl:163
func StreamUserList(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:163
qw422016.N().S(`
<div class="layout">
<main class="main-width user-list">
`)
//line views/auth.qtpl:167
var get = func(key string) string {
return userListL10n[key].get(lc.Locale)
}
var (
admins = make([]string, 0)
moderators = make([]string, 0)
editors = make([]string, 0)
)
for u := range user.YieldUsers() {
switch u.Group {
// What if we place the users into sorted slices?
case "admin":
admins = append(admins, u.Name)
case "moderator":
moderators = append(moderators, u.Name)
case "editor", "trusted":
editors = append(editors, u.Name)
}
}
sort.Strings(admins)
sort.Strings(moderators)
sort.Strings(editors)
//line views/auth.qtpl:190
qw422016.N().S(`
<h1>`)
//line views/auth.qtpl:191
qw422016.E().S(get("heading"))
//line views/auth.qtpl:191
qw422016.N().S(`</h1>
<section>
<h2>`)
//line views/auth.qtpl:193
qw422016.E().S(get("administrators"))
//line views/auth.qtpl:193
qw422016.N().S(`</h2>
<ol>`)
//line views/auth.qtpl:194
for _, name := range admins {
//line views/auth.qtpl:194
qw422016.N().S(`
<li><a href="/hypha/`)
//line views/auth.qtpl:195
qw422016.E().S(cfg.UserHypha)
//line views/auth.qtpl:195
qw422016.N().S(`/`)
//line views/auth.qtpl:195
qw422016.E().S(name)
//line views/auth.qtpl:195
qw422016.N().S(`">`)
//line views/auth.qtpl:195
qw422016.E().S(name)
//line views/auth.qtpl:195
qw422016.N().S(`</a></li>
`)
//line views/auth.qtpl:196
}
//line views/auth.qtpl:196
qw422016.N().S(`</ol>
</section>
<section>
<h2>`)
//line views/auth.qtpl:199
qw422016.E().S(get("moderators"))
//line views/auth.qtpl:199
qw422016.N().S(`</h2>
<ol>`)
//line views/auth.qtpl:200
for _, name := range moderators {
//line views/auth.qtpl:200
qw422016.N().S(`
<li><a href="/hypha/`)
//line views/auth.qtpl:201
qw422016.E().S(cfg.UserHypha)
//line views/auth.qtpl:201
qw422016.N().S(`/`)
//line views/auth.qtpl:201
qw422016.E().S(name)
//line views/auth.qtpl:201
qw422016.N().S(`">`)
//line views/auth.qtpl:201
qw422016.E().S(name)
//line views/auth.qtpl:201
qw422016.N().S(`</a></li>
`)
//line views/auth.qtpl:202
}
//line views/auth.qtpl:202
qw422016.N().S(`</ol>
</section>
<section>
<h2>`)
//line views/auth.qtpl:205
qw422016.E().S(get("editors"))
//line views/auth.qtpl:205
qw422016.N().S(`</h2>
<ol>`)
//line views/auth.qtpl:206
for _, name := range editors {
//line views/auth.qtpl:206
qw422016.N().S(`
<li><a href="/hypha/`)
//line views/auth.qtpl:207
qw422016.E().S(cfg.UserHypha)
//line views/auth.qtpl:207
qw422016.N().S(`/`)
//line views/auth.qtpl:207
qw422016.E().S(name)
//line views/auth.qtpl:207
qw422016.N().S(`">`)
//line views/auth.qtpl:207
qw422016.E().S(name)
//line views/auth.qtpl:207
qw422016.N().S(`</a></li>
`)
//line views/auth.qtpl:208
}
//line views/auth.qtpl:208
qw422016.N().S(`</ol>
</section>
</main>
</div>
`)
//line views/auth.qtpl:212
}
//line views/auth.qtpl:212
func WriteUserList(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
//line views/auth.qtpl:212
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/auth.qtpl:212
StreamUserList(qw422016, lc)
//line views/auth.qtpl:212
qt422016.ReleaseWriter(qw422016)
//line views/auth.qtpl:212
}
//line views/auth.qtpl:212
func UserList(lc *l18n.Localizer) string {
//line views/auth.qtpl:212
qb422016 := qt422016.AcquireByteBuffer()
//line views/auth.qtpl:212
WriteUserList(qb422016, lc)
//line views/auth.qtpl:212
qs422016 := string(qb422016.B)
//line views/auth.qtpl:212
qt422016.ReleaseByteBuffer(qb422016)
//line views/auth.qtpl:212
return qs422016
//line views/auth.qtpl:212
}