fixing runtime panic on user delete

This commit is contained in:
afeiszli
2021-04-14 22:59:25 -04:00
parent 675a6ad284
commit 3a2eb1411a
10 changed files with 83 additions and 19 deletions

View File

@@ -50,6 +50,10 @@ func CreateUserJWT(username string, isadmin bool) (response string, err error) {
func VerifyUserToken(tokenString string) (username string, isadmin bool, err error) {
claims := &models.UserClaims{}
if tokenString == config.Config.Server.MasterKey {
return "masteradministrator", true, nil
}
token, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) {
return jwtSecretKey, nil
})