single db with prefixes, dump/restore, blacklisting on user deletion
This commit is contained in:
parent
62ff59957a
commit
d4971cda89
20 changed files with 264 additions and 163 deletions
|
|
@ -100,7 +100,7 @@ func loginHandler(ctx *Context) {
|
|||
ctx.Error(err)
|
||||
return
|
||||
}
|
||||
ctx.SetCookie(jwt.Claims{userClaim: u.Username, adminClaim: u.Admin})
|
||||
ctx.SetCookie(jwt.Claims{userClaim: u.Username, createdClaim: u.Created, adminClaim: u.Admin})
|
||||
ctx.Redirect(core.IndexURI, 302)
|
||||
}
|
||||
}
|
||||
|
|
@ -195,6 +195,13 @@ func pageHandler(ctx *Context) {
|
|||
return
|
||||
}
|
||||
user = t.Claims.GetString(sharedClaim)
|
||||
if ctx.Srv.DB.LockedOut(user, t.Claims.GetString(createdClaim)) {
|
||||
if err = ctx.Srv.JWT.Invalidate(t); err != nil {
|
||||
log.Println("Invalidate:", err)
|
||||
}
|
||||
ctx.NotFound()
|
||||
return
|
||||
}
|
||||
section = t.Claims.GetString(sectionClaim)
|
||||
title = t.Claims.GetString(titleClaim)
|
||||
ctx.Data.Key = key
|
||||
|
|
@ -259,6 +266,7 @@ func pageShareHandler(ctx *Context) {
|
|||
}
|
||||
t := jwt.NewToken(map[string]interface{}{
|
||||
sharedClaim: user,
|
||||
createdClaim: ctx.Token.Claims.GetString(createdClaim),
|
||||
sectionClaim: section,
|
||||
titleClaim: title,
|
||||
jwt.ExpClaim: jwt.NewExp(d),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue