// 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 //line views/auth.qtpl:1 import "net/http" //line views/auth.qtpl:2 import "sort" //line views/auth.qtpl:3 import "github.com/bouncepaw/mycorrhiza/cfg" //line views/auth.qtpl:4 import "github.com/bouncepaw/mycorrhiza/l18n" //line views/auth.qtpl:5 import "github.com/bouncepaw/mycorrhiza/user" //line views/auth.qtpl:7 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) //line views/auth.qtpl:7 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) //line views/auth.qtpl:7 func StreamRegister(qw422016 *qt422016.Writer, rq *http.Request) { //line views/auth.qtpl:7 qw422016.N().S(` `) //line views/auth.qtpl:9 lc := l18n.FromRequest(rq) //line views/auth.qtpl:10 qw422016.N().S(`
`) //line views/auth.qtpl:14 if cfg.AllowRegistration { //line views/auth.qtpl:14 qw422016.N().S(` `) //line views/auth.qtpl:32 streamtelegramWidget(qw422016, lc) //line views/auth.qtpl:32 qw422016.N().S(` `) //line views/auth.qtpl:33 } else if cfg.UseAuth { //line views/auth.qtpl:33 qw422016.N().S(`

`) //line views/auth.qtpl:34 qw422016.E().S(lc.Get("auth.noregister")) //line views/auth.qtpl:34 qw422016.N().S(`

← `) //line views/auth.qtpl:35 qw422016.E().S(lc.Get("auth.go_back")) //line views/auth.qtpl:35 qw422016.N().S(`

`) //line views/auth.qtpl:36 } else { //line views/auth.qtpl:36 qw422016.N().S(`

`) //line views/auth.qtpl:37 qw422016.E().S(lc.Get("auth.noauth")) //line views/auth.qtpl:37 qw422016.N().S(`

← `) //line views/auth.qtpl:38 qw422016.E().S(lc.Get("auth.go_back")) //line views/auth.qtpl:38 qw422016.N().S(`

`) //line views/auth.qtpl:39 } //line views/auth.qtpl:39 qw422016.N().S(`
`) //line views/auth.qtpl:43 } //line views/auth.qtpl:43 func WriteRegister(qq422016 qtio422016.Writer, rq *http.Request) { //line views/auth.qtpl:43 qw422016 := qt422016.AcquireWriter(qq422016) //line views/auth.qtpl:43 StreamRegister(qw422016, rq) //line views/auth.qtpl:43 qt422016.ReleaseWriter(qw422016) //line views/auth.qtpl:43 } //line views/auth.qtpl:43 func Register(rq *http.Request) string { //line views/auth.qtpl:43 qb422016 := qt422016.AcquireByteBuffer() //line views/auth.qtpl:43 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 func StreamLogin(qw422016 *qt422016.Writer, lc *l18n.Localizer) { //line views/auth.qtpl:45 qw422016.N().S(`
`) //line views/auth.qtpl:49 if cfg.UseAuth { //line views/auth.qtpl:49 qw422016.N().S(` `) //line views/auth.qtpl:65 streamtelegramWidget(qw422016, lc) //line views/auth.qtpl:65 qw422016.N().S(` `) //line views/auth.qtpl:66 } else { //line views/auth.qtpl:66 qw422016.N().S(`

`) //line views/auth.qtpl:67 qw422016.E().S(lc.Get("auth.noauth")) //line views/auth.qtpl:67 qw422016.N().S(`

← `) //line views/auth.qtpl:68 qw422016.E().S(lc.Get("auth.go_home")) //line views/auth.qtpl:68 qw422016.N().S(`

`) //line views/auth.qtpl:69 } //line views/auth.qtpl:69 qw422016.N().S(`
`) //line views/auth.qtpl:73 } //line views/auth.qtpl:73 func WriteLogin(qq422016 qtio422016.Writer, lc *l18n.Localizer) { //line views/auth.qtpl:73 qw422016 := qt422016.AcquireWriter(qq422016) //line views/auth.qtpl:73 StreamLogin(qw422016, lc) //line views/auth.qtpl:73 qt422016.ReleaseWriter(qw422016) //line views/auth.qtpl:73 } //line views/auth.qtpl:73 func Login(lc *l18n.Localizer) string { //line views/auth.qtpl:73 qb422016 := qt422016.AcquireByteBuffer() //line views/auth.qtpl:73 WriteLogin(qb422016, lc) //line views/auth.qtpl:73 qs422016 := string(qb422016.B) //line views/auth.qtpl:73 qt422016.ReleaseByteBuffer(qb422016) //line views/auth.qtpl:73 return qs422016 //line views/auth.qtpl:73 } // 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 func streamtelegramWidget(qw422016 *qt422016.Writer, lc *l18n.Localizer) { //line views/auth.qtpl:76 qw422016.N().S(` `) //line views/auth.qtpl:77 if cfg.TelegramEnabled { //line views/auth.qtpl:77 qw422016.N().S(`

`) //line views/auth.qtpl:78 qw422016.E().S(lc.Get("auth.telegram_tip")) //line views/auth.qtpl:78 qw422016.N().S(`

`) //line views/auth.qtpl:80 } //line views/auth.qtpl:80 qw422016.N().S(` `) //line views/auth.qtpl:81 } //line views/auth.qtpl:81 func writetelegramWidget(qq422016 qtio422016.Writer, lc *l18n.Localizer) { //line views/auth.qtpl:81 qw422016 := qt422016.AcquireWriter(qq422016) //line views/auth.qtpl:81 streamtelegramWidget(qw422016, lc) //line views/auth.qtpl:81 qt422016.ReleaseWriter(qw422016) //line views/auth.qtpl:81 } //line views/auth.qtpl:81 func telegramWidget(lc *l18n.Localizer) string { //line views/auth.qtpl:81 qb422016 := qt422016.AcquireByteBuffer() //line views/auth.qtpl:81 writetelegramWidget(qb422016, lc) //line views/auth.qtpl:81 qs422016 := string(qb422016.B) //line views/auth.qtpl:81 qt422016.ReleaseByteBuffer(qb422016) //line views/auth.qtpl:81 return qs422016 //line views/auth.qtpl:81 } //line views/auth.qtpl:83 func StreamLoginError(qw422016 *qt422016.Writer, err string, lc *l18n.Localizer) { //line views/auth.qtpl:83 qw422016.N().S(`
`) //line views/auth.qtpl:87 switch err { //line views/auth.qtpl:88 case "unknown username": //line views/auth.qtpl:88 qw422016.N().S(`

`) //line views/auth.qtpl:89 qw422016.E().S(lc.Get("auth.error_username")) //line views/auth.qtpl:89 qw422016.N().S(`

`) //line views/auth.qtpl:90 case "wrong password": //line views/auth.qtpl:90 qw422016.N().S(`

`) //line views/auth.qtpl:91 qw422016.E().S(lc.Get("auth.error_password")) //line views/auth.qtpl:91 qw422016.N().S(`

`) //line views/auth.qtpl:92 default: //line views/auth.qtpl:92 qw422016.N().S(`

`) //line views/auth.qtpl:93 qw422016.E().S(err) //line views/auth.qtpl:93 qw422016.N().S(`

`) //line views/auth.qtpl:94 } //line views/auth.qtpl:94 qw422016.N().S(`

← `) //line views/auth.qtpl:95 qw422016.E().S(lc.Get("auth.try_again")) //line views/auth.qtpl:95 qw422016.N().S(`

`) //line views/auth.qtpl:99 } //line views/auth.qtpl:99 func WriteLoginError(qq422016 qtio422016.Writer, err string, lc *l18n.Localizer) { //line views/auth.qtpl:99 qw422016 := qt422016.AcquireWriter(qq422016) //line views/auth.qtpl:99 StreamLoginError(qw422016, err, lc) //line views/auth.qtpl:99 qt422016.ReleaseWriter(qw422016) //line views/auth.qtpl:99 } //line views/auth.qtpl:99 func LoginError(err string, lc *l18n.Localizer) string { //line views/auth.qtpl:99 qb422016 := qt422016.AcquireByteBuffer() //line views/auth.qtpl:99 WriteLoginError(qb422016, err, lc) //line views/auth.qtpl:99 qs422016 := string(qb422016.B) //line views/auth.qtpl:99 qt422016.ReleaseByteBuffer(qb422016) //line views/auth.qtpl:99 return qs422016 //line views/auth.qtpl:99 } //line views/auth.qtpl:101 func StreamLogout(qw422016 *qt422016.Writer, can bool, lc *l18n.Localizer) { //line views/auth.qtpl:101 qw422016.N().S(`
`) //line views/auth.qtpl:105 if can { //line views/auth.qtpl:105 qw422016.N().S(`

`) //line views/auth.qtpl:106 qw422016.E().S(lc.Get("auth.logout_header")) //line views/auth.qtpl:106 qw422016.N().S(`

`) //line views/auth.qtpl:109 qw422016.E().S(lc.Get("auth.go_home")) //line views/auth.qtpl:109 qw422016.N().S(`
`) //line views/auth.qtpl:111 } else { //line views/auth.qtpl:111 qw422016.N().S(`

`) //line views/auth.qtpl:112 qw422016.E().S(lc.Get("auth.logout_anon")) //line views/auth.qtpl:112 qw422016.N().S(`

`) //line views/auth.qtpl:113 qw422016.E().S(lc.Get("auth.login_title")) //line views/auth.qtpl:113 qw422016.N().S(`

← `) //line views/auth.qtpl:114 qw422016.E().S(lc.Get("auth.go_home")) //line views/auth.qtpl:114 qw422016.N().S(`

`) //line views/auth.qtpl:115 } //line views/auth.qtpl:115 qw422016.N().S(`
`) //line views/auth.qtpl:119 } //line views/auth.qtpl:119 func WriteLogout(qq422016 qtio422016.Writer, can bool, lc *l18n.Localizer) { //line views/auth.qtpl:119 qw422016 := qt422016.AcquireWriter(qq422016) //line views/auth.qtpl:119 StreamLogout(qw422016, can, lc) //line views/auth.qtpl:119 qt422016.ReleaseWriter(qw422016) //line views/auth.qtpl:119 } //line views/auth.qtpl:119 func Logout(can bool, lc *l18n.Localizer) string { //line views/auth.qtpl:119 qb422016 := qt422016.AcquireByteBuffer() //line views/auth.qtpl:119 WriteLogout(qb422016, can, lc) //line views/auth.qtpl:119 qs422016 := string(qb422016.B) //line views/auth.qtpl:119 qt422016.ReleaseByteBuffer(qb422016) //line views/auth.qtpl:119 return qs422016 //line views/auth.qtpl:119 } //line views/auth.qtpl:121 func StreamLock(qw422016 *qt422016.Writer, lc *l18n.Localizer) { //line views/auth.qtpl:121 qw422016.N().S(` 🔒 `) //line views/auth.qtpl:127 qw422016.E().S(lc.Get("auth.lock_title")) //line views/auth.qtpl:127 qw422016.N().S(`

🔒

`) //line views/auth.qtpl:135 qw422016.E().S(lc.Get("auth.lock_title")) //line views/auth.qtpl:135 qw422016.N().S(`

`) //line views/auth.qtpl:147 streamtelegramWidget(qw422016, lc) //line views/auth.qtpl:147 qw422016.N().S(`
`) //line views/auth.qtpl:152 } //line views/auth.qtpl:152 func WriteLock(qq422016 qtio422016.Writer, lc *l18n.Localizer) { //line views/auth.qtpl:152 qw422016 := qt422016.AcquireWriter(qq422016) //line views/auth.qtpl:152 StreamLock(qw422016, lc) //line views/auth.qtpl:152 qt422016.ReleaseWriter(qw422016) //line views/auth.qtpl:152 } //line views/auth.qtpl:152 func Lock(lc *l18n.Localizer) string { //line views/auth.qtpl:152 qb422016 := qt422016.AcquireByteBuffer() //line views/auth.qtpl:152 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(`
`) //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(`

`) //line views/auth.qtpl:191 qw422016.E().S(get("heading")) //line views/auth.qtpl:191 qw422016.N().S(`

`) //line views/auth.qtpl:193 qw422016.E().S(get("administrators")) //line views/auth.qtpl:193 qw422016.N().S(`

    `) //line views/auth.qtpl:194 for _, name := range admins { //line views/auth.qtpl:194 qw422016.N().S(`
  1. `) //line views/auth.qtpl:195 qw422016.E().S(name) //line views/auth.qtpl:195 qw422016.N().S(`
  2. `) //line views/auth.qtpl:196 } //line views/auth.qtpl:196 qw422016.N().S(`

`) //line views/auth.qtpl:199 qw422016.E().S(get("moderators")) //line views/auth.qtpl:199 qw422016.N().S(`

    `) //line views/auth.qtpl:200 for _, name := range moderators { //line views/auth.qtpl:200 qw422016.N().S(`
  1. `) //line views/auth.qtpl:201 qw422016.E().S(name) //line views/auth.qtpl:201 qw422016.N().S(`
  2. `) //line views/auth.qtpl:202 } //line views/auth.qtpl:202 qw422016.N().S(`

`) //line views/auth.qtpl:205 qw422016.E().S(get("editors")) //line views/auth.qtpl:205 qw422016.N().S(`

    `) //line views/auth.qtpl:206 for _, name := range editors { //line views/auth.qtpl:206 qw422016.N().S(`
  1. `) //line views/auth.qtpl:207 qw422016.E().S(name) //line views/auth.qtpl:207 qw422016.N().S(`
  2. `) //line views/auth.qtpl:208 } //line views/auth.qtpl:208 qw422016.N().S(`
`) //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 }