parent
3c5b00ef14
commit
4a9bb7f4f3
@ -91,6 +91,7 @@ namespace api {
|
|||||||
cbk(drogon::HttpResponse::newRedirectionResponse(ss.str()));
|
cbk(drogon::HttpResponse::newRedirectionResponse(ss.str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string disabled_resp = "<!DOCTYPE html><html><h2>Your account is disabled, please contact an admin. <a href=\"/login\">Go to login page</a></h2></html>";
|
||||||
void auth::gitlab_callback(req_type, cbk_type cbk, std::string code) {
|
void auth::gitlab_callback(req_type, cbk_type cbk, std::string code) {
|
||||||
auto tokens = get_gitlab_tokens(code, false);
|
auto tokens = get_gitlab_tokens(code, false);
|
||||||
if (!tokens.has_value())
|
if (!tokens.has_value())
|
||||||
@ -123,6 +124,9 @@ namespace api {
|
|||||||
db_user.setGitlabRt(tokens->rt);
|
db_user.setGitlabRt(tokens->rt);
|
||||||
user_mapper.update(db_user);
|
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);
|
const std::string& token = get_token(db_user);
|
||||||
cbk(drogon::HttpResponse::newRedirectionResponse("/set_token?token="+token));
|
cbk(drogon::HttpResponse::newRedirectionResponse("/set_token?token="+token));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user