github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/verror/Unauthorized.html.go (about)

     1  // Code generated by qtc from "Unauthorized.html". DO NOT EDIT.
     2  // See https://github.com/valyala/quicktemplate for details.
     3  
     4  // <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     5  
     6  //line views/verror/Unauthorized.html:2
     7  package verror
     8  
     9  //line views/verror/Unauthorized.html:2
    10  import (
    11  	"github.com/kyleu/dbaudit/app"
    12  	"github.com/kyleu/dbaudit/app/controller/cutil"
    13  	"github.com/kyleu/dbaudit/app/lib/user"
    14  	"github.com/kyleu/dbaudit/views/layout"
    15  )
    16  
    17  //line views/verror/Unauthorized.html:9
    18  import (
    19  	qtio422016 "io"
    20  
    21  	qt422016 "github.com/valyala/quicktemplate"
    22  )
    23  
    24  //line views/verror/Unauthorized.html:9
    25  var (
    26  	_ = qtio422016.Copy
    27  	_ = qt422016.AcquireByteBuffer
    28  )
    29  
    30  //line views/verror/Unauthorized.html:9
    31  type Unauthorized struct {
    32  	layout.Basic
    33  	Path     string
    34  	Message  string
    35  	Accounts user.Accounts
    36  }
    37  
    38  //line views/verror/Unauthorized.html:16
    39  func (p *Unauthorized) StreamBody(qw422016 *qt422016.Writer, as *app.State, ps *cutil.PageState) {
    40  //line views/verror/Unauthorized.html:16
    41  	qw422016.N().S(`
    42    <div class="card">
    43      <h3>Unauthorized</h3>
    44      <em>`)
    45  //line views/verror/Unauthorized.html:19
    46  	qw422016.E().S(p.Message)
    47  //line views/verror/Unauthorized.html:19
    48  	qw422016.N().S(`</em>
    49      <p>You're not authorized to view <code>`)
    50  //line views/verror/Unauthorized.html:20
    51  	qw422016.E().S(p.Path)
    52  //line views/verror/Unauthorized.html:20
    53  	qw422016.N().S(`</code></p>
    54  `)
    55  //line views/verror/Unauthorized.html:21
    56  	if len(p.Accounts) == 0 {
    57  //line views/verror/Unauthorized.html:21
    58  		qw422016.N().S(`    <p>Sorry about that, maybe try <a href="`)
    59  //line views/verror/Unauthorized.html:22
    60  		qw422016.E().S(as.Auth.LoginURL())
    61  //line views/verror/Unauthorized.html:22
    62  		qw422016.N().S(`">logging in</a>?</p>
    63  `)
    64  //line views/verror/Unauthorized.html:23
    65  	}
    66  //line views/verror/Unauthorized.html:23
    67  	qw422016.N().S(`  </div>
    68  `)
    69  //line views/verror/Unauthorized.html:25
    70  }
    71  
    72  //line views/verror/Unauthorized.html:25
    73  func (p *Unauthorized) WriteBody(qq422016 qtio422016.Writer, as *app.State, ps *cutil.PageState) {
    74  //line views/verror/Unauthorized.html:25
    75  	qw422016 := qt422016.AcquireWriter(qq422016)
    76  //line views/verror/Unauthorized.html:25
    77  	p.StreamBody(qw422016, as, ps)
    78  //line views/verror/Unauthorized.html:25
    79  	qt422016.ReleaseWriter(qw422016)
    80  //line views/verror/Unauthorized.html:25
    81  }
    82  
    83  //line views/verror/Unauthorized.html:25
    84  func (p *Unauthorized) Body(as *app.State, ps *cutil.PageState) string {
    85  //line views/verror/Unauthorized.html:25
    86  	qb422016 := qt422016.AcquireByteBuffer()
    87  //line views/verror/Unauthorized.html:25
    88  	p.WriteBody(qb422016, as, ps)
    89  //line views/verror/Unauthorized.html:25
    90  	qs422016 := string(qb422016.B)
    91  //line views/verror/Unauthorized.html:25
    92  	qt422016.ReleaseByteBuffer(qb422016)
    93  //line views/verror/Unauthorized.html:25
    94  	return qs422016
    95  //line views/verror/Unauthorized.html:25
    96  }