feat: add employee role and block backend login
This commit is contained in:
@@ -43,6 +43,10 @@ func (c *AuthController) Login(ctx *gin.Context) {
|
||||
ErrorResponse(ctx, http.StatusUnauthorized, err.Error())
|
||||
return
|
||||
}
|
||||
if user.Role == "employee" {
|
||||
ErrorResponse(ctx, http.StatusForbidden, "员工账号无后台登录权限")
|
||||
return
|
||||
}
|
||||
|
||||
token, err := c.authService.GenerateToken(user)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user