From 25376aba1ebf991504ccad362bd273e29bf0b563 Mon Sep 17 00:00:00 2001 From: postables Date: Fri, 17 Apr 2020 19:00:47 -0700 Subject: [PATCH] api/middleware: update authorizator to check both email & account stat --- api/middleware/jwt.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/middleware/jwt.go b/api/middleware/jwt.go index 27974d7e8..4ab71eb48 100644 --- a/api/middleware/jwt.go +++ b/api/middleware/jwt.go @@ -62,7 +62,10 @@ func JwtConfigGenerate(jwtKey, realmName string, db *gorm.DB, l *zap.SugaredLogg if err != nil { return false } - return usr.EmailEnabled + if usr.EmailEnabled && usr.AccountEnabled { + return true + } + return false }, Unauthorized: func(c *gin.Context, code int, message string) { l.Error("invalid login detected")