diff --git a/backend/src/controllers/auth/auth_gitlab.cpp b/backend/src/controllers/auth/auth_gitlab.cpp index 2af6d53..835eb16 100644 --- a/backend/src/controllers/auth/auth_gitlab.cpp +++ b/backend/src/controllers/auth/auth_gitlab.cpp @@ -91,6 +91,7 @@ namespace api { cbk(drogon::HttpResponse::newRedirectionResponse(ss.str())); } + std::string disabled_resp = "

Your account is disabled, please contact an admin. Go to login page

"; void auth::gitlab_callback(req_type, cbk_type cbk, std::string code) { auto tokens = get_gitlab_tokens(code, false); if (!tokens.has_value()) @@ -123,6 +124,9 @@ namespace api { db_user.setGitlabRt(tokens->rt); user_mapper.update(db_user); + if (db::User_getEnumRole(db_user) == db::UserRole::DISABLED) + return cbk(drogon::HttpResponse::newFileResponse((unsigned char*)disabled_resp.data(), disabled_resp.size(), "", drogon::ContentType::CT_TEXT_HTML)); + const std::string& token = get_token(db_user); cbk(drogon::HttpResponse::newRedirectionResponse("/set_token?token="+token)); }