Update server dependencies

This commit is contained in:
Hanzei 2018-09-23 08:18:35 +02:00
parent d0df44c109
commit d918262365
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
31 changed files with 1233 additions and 806 deletions

View file

@ -135,6 +135,20 @@ func (me *Session) GetUserRoles() []string {
return strings.Fields(me.Roles)
}
func (me *Session) GenerateCSRF() string {
token := NewId()
me.AddProp("csrf", token)
return token
}
func (me *Session) GetCSRF() string {
if me.Props == nil {
return ""
}
return me.Props["csrf"]
}
func SessionsToJson(o []*Session) string {
if b, err := json.Marshal(o); err != nil {
return "[]"