fixed api calls
This commit is contained in:
parent
8874df02d2
commit
69df101cb8
2 changed files with 28 additions and 14 deletions
|
|
@ -116,7 +116,7 @@ func loginHandler(ctx *Context) {
|
|||
data loginData
|
||||
err error
|
||||
)
|
||||
data.LoginChallenge = ctx.Var("login_challenge")
|
||||
data.LoginChallenge = ctx.Query("login_challenge")
|
||||
ctx.Template("loginHandler")
|
||||
ctx.Data = webData{
|
||||
Title: "Login",
|
||||
|
|
@ -198,7 +198,7 @@ func loginTotpHandler(ctx *Context) {
|
|||
var data loginData
|
||||
switch ctx.Method() {
|
||||
case "GET":
|
||||
data.LoginChallenge = ctx.Var("login_challenge")
|
||||
data.LoginChallenge = ctx.Query("login_challenge")
|
||||
ctx.Data.Data = data
|
||||
ctx.Exec()
|
||||
case "POST":
|
||||
|
|
@ -227,6 +227,8 @@ func loginTotpHandler(ctx *Context) {
|
|||
rdr, err = ctx.ApproveLogin(user, data.LoginChallenge)
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.log.Error(err, "error approving login")
|
||||
ctx.Error("error approving login")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -243,11 +245,12 @@ func consentHandler(ctx *Context) {
|
|||
var data consentData
|
||||
switch ctx.Method() {
|
||||
case "GET":
|
||||
data.ConsentChallenge = ctx.Var("consent_challenge")
|
||||
data.ConsentChallenge = ctx.Query("consent_challenge")
|
||||
ctx.Data.Data = data
|
||||
ci, err := ctx.Consent(data.ConsentChallenge)
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.log.Error(err, "error getting consent info")
|
||||
ctx.Error("error getting consent info")
|
||||
return
|
||||
}
|
||||
data.Info = ci
|
||||
|
|
@ -266,13 +269,15 @@ func consentHandler(ctx *Context) {
|
|||
if consent == "approve" {
|
||||
rdr, err = ctx.ApproveConsent(data.ConsentChallenge)
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.log.Error(err, "error approving consent")
|
||||
ctx.Error("error approving consent")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
rdr, err = ctx.RejectConsent(data.ConsentChallenge)
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.log.Error(err, "error rejecting consent")
|
||||
ctx.Error("error rejecting consent")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue