first working version
This commit is contained in:
parent
398ff981d1
commit
39cae64854
8 changed files with 23 additions and 16 deletions
|
|
@ -64,6 +64,7 @@ func newHandler(ctx *types.Context) {
|
|||
|
||||
func keyHandler(ctx *types.Context) {
|
||||
id := ctx.Var("id")
|
||||
ip := ctx.ClientIP()
|
||||
k, err := ctx.Data.DB.GetKey(id)
|
||||
if err != nil {
|
||||
ctx.Log.Error(err, "error reading key", "id", id)
|
||||
|
|
@ -78,7 +79,7 @@ func keyHandler(ctx *types.Context) {
|
|||
case "GET":
|
||||
aid := ctx.Var("aid")
|
||||
if aid == "" {
|
||||
aid, err = ctx.Data.Approver.New(id, k.Name)
|
||||
aid, err = ctx.Data.Approver.New(id, k.Name, ip)
|
||||
if err != nil {
|
||||
ctx.Log.Error(err, "error creating approval", "id", id, "name", k.Name)
|
||||
ctx.Err(types.ErrISE)
|
||||
|
|
@ -87,7 +88,7 @@ func keyHandler(ctx *types.Context) {
|
|||
ctx.Redirect(schema.ApproveURL(id, aid), http.StatusFound)
|
||||
return
|
||||
}
|
||||
s := ctx.Data.Approver.Status(id, aid)
|
||||
s := ctx.Data.Approver.Status(id, aid, ip)
|
||||
switch s {
|
||||
case types.Pending:
|
||||
ctx.Redirect(schema.ApproveURL(id, aid), http.StatusFound)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue