feat: support authentik aouth2.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -307,6 +307,11 @@
|
||||
<label for="github-provider">GitHub login</label>
|
||||
</div>
|
||||
|
||||
<div class="row no-border commento-round-check" v-if="configuredOauths.authentik">
|
||||
<input type="checkbox" v-model="domains[cd].authentikProvider" id="authentik-provider">
|
||||
<label for="authentik-provider">authentik Login</label>
|
||||
</div>
|
||||
|
||||
<div class="row no-border commento-round-check" v-if="configuredOauths.gitlab">
|
||||
<input type="checkbox" v-model="domains[cd].gitlabProvider" id="gitlab-provider">
|
||||
<label for="gitlab-provider">GitLab login</label>
|
||||
@@ -335,7 +340,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="warning" v-if="!domains[cd].allowAnonymous && !domains[cd].commentoProvider && (!configuredOauths.google || !domains[cd].googleProvider) && (!configuredOauths.twitter || !domains[cd].twitterProvider) && (!configuredOauths.github || !domains[cd].githubProvider) && (!configuredOauths.gitlab || !domains[cd].gitlabProvider) && !domains[cd].ssoProvider">
|
||||
<div class="warning" v-if="!domains[cd].allowAnonymous && !domains[cd].commentoProvider && (!configuredOauths.google || !domains[cd].googleProvider) && (!configuredOauths.twitter || !domains[cd].twitterProvider) && (!configuredOauths.github || !domains[cd].githubProvider) && (!configuredOauths.authentik || !domains[cd].authentikProvider) && (!configuredOauths.gitlab || !domains[cd].gitlabProvider) && !domains[cd].ssoProvider">
|
||||
You have disabled all authentication options. Your readers will not be able to login, create comments, or vote.
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -26,6 +26,8 @@
|
||||
var ID_LOGIN_BOX_LOGIN_LINK_CONTAINER = "commento-login-box-login-link-container";
|
||||
var ID_LOGIN_BOX_SSO_PRETEXT = "commento-login-box-sso-pretext";
|
||||
var ID_LOGIN_BOX_SSO_BUTTON_CONTAINER = "commento-login-box-sso-buttton-container";
|
||||
var ID_LOGIN_BOX_AUTHENTIK_PRETEXT = "commento-login-box-authentik-pretext";
|
||||
var ID_LOGIN_BOX_AUTHENTIK_BUTTON_CONTAINER = "commento-login-box-authentik-buttton-container";
|
||||
var ID_LOGIN_BOX_HR1 = "commento-login-box-hr1";
|
||||
var ID_LOGIN_BOX_OAUTH_PRETEXT = "commento-login-box-oauth-pretext";
|
||||
var ID_LOGIN_BOX_OAUTH_BUTTONS_CONTAINER = "commento-login-box-oauth-buttons-container";
|
||||
@@ -1599,6 +1601,9 @@
|
||||
var ssoSubtitle = create("div");
|
||||
var ssoButtonContainer = create("div");
|
||||
var ssoButton = create("div");
|
||||
var authentikSubtitle = create("div");
|
||||
var authentikButtonContainer = create("div");
|
||||
var authentikButton = create("div");
|
||||
var hr1 = create("hr");
|
||||
var oauthSubtitle = create("div");
|
||||
var oauthButtonsContainer = create("div");
|
||||
@@ -1623,6 +1628,8 @@
|
||||
loginLinkContainer.id = ID_LOGIN_BOX_LOGIN_LINK_CONTAINER;
|
||||
ssoButtonContainer.id = ID_LOGIN_BOX_SSO_BUTTON_CONTAINER;
|
||||
ssoSubtitle.id = ID_LOGIN_BOX_SSO_PRETEXT;
|
||||
authentikButtonContainer.id = ID_LOGIN_BOX_AUTHENTIK_BUTTON_CONTAINER;
|
||||
authentikSubtitle.id = ID_LOGIN_BOX_AUTHENTIK_PRETEXT;
|
||||
hr1.id = ID_LOGIN_BOX_HR1;
|
||||
oauthSubtitle.id = ID_LOGIN_BOX_OAUTH_PRETEXT;
|
||||
oauthButtonsContainer.id = ID_LOGIN_BOX_OAUTH_BUTTONS_CONTAINER;
|
||||
@@ -1642,6 +1649,9 @@
|
||||
classAdd(ssoSubtitle, "login-box-subtitle");
|
||||
classAdd(ssoButtonContainer, "oauth-buttons-container");
|
||||
classAdd(ssoButton, "oauth-buttons");
|
||||
classAdd(authentikSubtitle, "login-box-subtitle");
|
||||
classAdd(authentikButtonContainer, "oauth-buttons-container");
|
||||
classAdd(authentikButton, "oauth-buttons");
|
||||
classAdd(oauthSubtitle, "login-box-subtitle");
|
||||
classAdd(oauthButtonsContainer, "oauth-buttons-container");
|
||||
classAdd(oauthButtons, "oauth-buttons");
|
||||
@@ -1654,6 +1664,7 @@
|
||||
emailButton.innerText = "Continue";
|
||||
oauthSubtitle.innerText = "Proceed with social login";
|
||||
ssoSubtitle.innerText = "Proceed with " + parent.location.host + " authentication";
|
||||
authentikSubtitle.innerText = "Proceed with " + parent.location.host + " authentication";
|
||||
|
||||
onclick(emailButton, global.passwordAsk, id);
|
||||
onclick(forgotLink, global.forgotPassword, id);
|
||||
@@ -1683,6 +1694,26 @@
|
||||
}
|
||||
});
|
||||
|
||||
if (configuredOauths["authentik"]) {
|
||||
var button = create("button");
|
||||
|
||||
classAdd(button, "button");
|
||||
classAdd(button, "authentik-button");
|
||||
|
||||
button.innerText = "Single Sign-On";
|
||||
|
||||
onclick(button, global.commentoAuth, {"provider": "authentik", "id": id});
|
||||
|
||||
append(authentikButton, button);
|
||||
append(authentikButtonContainer, authentikButton);
|
||||
append(loginBox, authentikSubtitle);
|
||||
append(loginBox, authentikButtonContainer);
|
||||
|
||||
if (numOauthConfigured > 0 || configuredOauths["commento"]) {
|
||||
append(loginBox, hr1);
|
||||
}
|
||||
}
|
||||
|
||||
if (configuredOauths["sso"]) {
|
||||
var button = create("button");
|
||||
|
||||
@@ -1756,6 +1787,12 @@
|
||||
remove($(ID_LOGIN_BOX_HR2));
|
||||
}
|
||||
|
||||
if (configuredOauths["authentik"]) {
|
||||
remove($(ID_LOGIN_BOX_AUTHONTIK_BUTTON_CONTAINER));
|
||||
remove($(ID_LOGIN_BOX_AUTHONTIK_PRETEXT));
|
||||
remove($(ID_LOGIN_BOX_HR1));
|
||||
remove($(ID_LOGIN_BOX_HR2));
|
||||
}
|
||||
if (configuredOauths["sso"]) {
|
||||
remove($(ID_LOGIN_BOX_SSO_BUTTON_CONTAINER));
|
||||
remove($(ID_LOGIN_BOX_SSO_PRETEXT));
|
||||
|
@@ -44,5 +44,12 @@
|
||||
font-size: 13px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.commento-authentik-button {
|
||||
background: #FD4B2D;
|
||||
text-transform: uppercase;
|
||||
font-size: 13px;
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user