Prevent panic when checking banned user if no auth is enabled

This commit is contained in:
Marcos Lilljedahl
2019-03-10 14:17:54 -03:00
parent 5afc852d2b
commit f7350b02c3
4 changed files with 14 additions and 13 deletions

View File

@@ -47,7 +47,7 @@ type SessionSetupInstanceConf struct {
func (p *pwd) SessionNew(ctx context.Context, config types.SessionConfig) (*types.Session, error) {
defer observeAction("SessionNew", time.Now())
if u, _ := p.storage.UserGet(config.UserId); u.IsBanned {
if u, err := p.storage.UserGet(config.UserId); err == nil && u.IsBanned {
return nil, fmt.Errorf("User %s is banned\n", config.UserId)
}