added consent template
This commit is contained in:
parent
f48fa210bb
commit
3c3ca3e7a7
6 changed files with 31 additions and 6 deletions
|
|
@ -87,7 +87,7 @@ type loginData struct {
|
|||
|
||||
type consentData struct {
|
||||
ConsentChallenge string
|
||||
Data *consentInfo
|
||||
Info *consentInfo
|
||||
}
|
||||
|
||||
func (c *Context) Exec() {
|
||||
|
|
@ -132,7 +132,7 @@ func (c *Context) Exec() {
|
|||
func (c *Context) accessLog() {
|
||||
log := c.log.WithValues("addr", c.Request.RemoteAddr,
|
||||
"method", c.Request.Method,
|
||||
"url", c.Request.RequestURI,
|
||||
"uri", c.Request.RequestURI,
|
||||
"status", c.Status,
|
||||
)
|
||||
if c.Err != nil {
|
||||
|
|
@ -184,7 +184,7 @@ func (c *Context) SetHeader(name, value string) {
|
|||
func (c *Context) Redirect(uri string, code int) {
|
||||
c.log.Info("access", "addr", c.Request.RemoteAddr,
|
||||
"method", c.Request.Method,
|
||||
"url", c.Request.RequestURI,
|
||||
"uri", c.Request.RequestURI,
|
||||
"status", code,
|
||||
"redirect", uri,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ func consentHandler(ctx *Context) {
|
|||
ctx.Error(err)
|
||||
return
|
||||
}
|
||||
data.Data = ci
|
||||
data.Info = ci
|
||||
ctx.Data.Data = data
|
||||
ctx.Exec()
|
||||
case "POST":
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ func (s *Server) loadTemplates() (err error) {
|
|||
s.ts.Parse(tfs, "notFoundHandler", "index.html", "menu.html", "notFound.html")
|
||||
s.ts.Parse(tfs, "loginHandler", "index.html", "menu.html", "login.html")
|
||||
s.ts.Parse(tfs, "loginTotpHandler", "index.html", "menu.html", "loginTotp.html")
|
||||
s.ts.Parse(tfs, "consentHandler", "index.html", "menu.html", "consent.html")
|
||||
// users
|
||||
s.ts.Parse(tfs, "usersHandler", "index.html", "menu.html", "users.html")
|
||||
s.ts.Parse(tfs, "userNewHandler", "index.html", "menu.html", "userNew.html")
|
||||
|
|
|
|||
24
pkg/server/templates/consent.html
Normal file
24
pkg/server/templates/consent.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{{define "body"}}
|
||||
{{if .Data}}
|
||||
<div class="row">
|
||||
<div class="col-xs-4 offset-4">
|
||||
<div class="card border-primary mx-auto">
|
||||
<div class="card-header">
|
||||
<strong>{{.BodyTitle}}</strong>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<pre>
|
||||
{{.Data.Info}}
|
||||
</pre>
|
||||
<form class="form-horizontal" action="/consent" method="post">
|
||||
<input type="hidden" name="token" value="{{.Token}}">
|
||||
<input type="hidden" name="consent_challenge" value="{{.Data.ConsentChallenge}}">
|
||||
<button class="btn btn-sm btn-primary" type="submit" name="Approve">Approve</button>
|
||||
<button class="btn btn-sm btn-primary" type="submit" name="Reject">Reject</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue