Skip to content

Commit

Permalink
Auth panels customizing.
Browse files Browse the repository at this point in the history
  • Loading branch information
msyk committed Jun 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 55c8f2a commit f366922
Showing 6 changed files with 49 additions and 4 deletions.
5 changes: 5 additions & 0 deletions dist-docs/change_log.txt
Original file line number Diff line number Diff line change
@@ -21,6 +21,11 @@ Ver.13 (In Development)
- Field values from SAML attributes can merge from multiple entries.
- Variables $limitEnrollSecond and $limitPwChangeSecond in the params.php file can specify the limit seconds for
the enrollment mail and password reset mail.
- INTERMediatorOnPage.authPanelExp and INTERMediatorOnPage.authPanelExp2FA can display any explanation
on authentication panels.
- In the params.php file, variables $authPanelTitle, $authPanelTitle2FA, $authPanelExp and $authPanelExp2FA can
describe and set any strings including html. These are elements of auth panels as the same name properties of
INTERMediatorOnPage object.
- [BUG FIX] On the Ver.12, SAML authentication didn't work in spite of Ver.11 can do. It didn't check with SAML manual
test on Ver.12 after added types to php codes. Ver.13 works SAML.

7 changes: 6 additions & 1 deletion params.php
Original file line number Diff line number Diff line change
@@ -153,12 +153,17 @@
//$alwaysGenSHA2 = true; // On the password changing, generate SHA-2 hash. The default is false.
//$migrateSHA1to2 = true;// If the login account relays on SHA-a, exchange it with 2m style SHA-2 hash. The default is false.
//$credentialCookieDomain = ""; // The domain information of the cookie for 'credential' auth. Falsy value means no domain, also the default.
//$isRequired2FA = true; // Default is false.
$isRequired2FA = true; // Default is false.
//$mailContext2FA = "mailtemplate@id=995"; // Template record for the mail to send the 2FA code.
//$digitsOf2FACode = 6; // Default is 4.
//$expiringSeconds2FA = 1000; // 2FA effective seconds from code input.
$fixed2FACode = "5555"; // Fixed 2FA code for the testing purpose. On the real system, this has to comment out.

$authPanelTitle= "そうだ"; // Auth Panel's title
$authPanelTitle2FA= null; // 2FA Auth Panel's title
$authPanelExp= "温泉に行こう"; // Auth Panel's explanations
$authPanelExp2FA= null; // 2FA Auth Panel's explanations

// The 'issuedhash' table for storing challenges of authentication can be use another database.
//$issuedHashDSN = 'sqlite:/var/db/im/sample.sq3';

2 changes: 2 additions & 0 deletions samples/Sample_Auth/MySQL_form_auth.html
Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@
<script>
INTERMediatorOnPage.doBeforeConstruct = function () {
INTERMediatorLog.suppressDebugMessageOnPage = true
// INTERMediatorOnPage.authPanelExp = "説明です。"
INTERMediatorOnPage.authPanelExp2FA = "説明です。"
}
</script>
</head>
19 changes: 19 additions & 0 deletions src/js/INTER-Mediator-Page.js
Original file line number Diff line number Diff line change
@@ -50,6 +50,8 @@ let INTERMediatorOnPage = {
isSetDefaultStyle: false,
authPanelTitle: null,
authPanelTitle2FA: null,
authPanelExp: null,
authPanelExp2FA: null,
isOAuthAvailable: false, // @Private
oAuthClientID: null, // @Private
oAuthClientSecret: null, // @Private
@@ -674,6 +676,14 @@ let INTERMediatorOnPage = {
INTERMediatorLib.getInsertedStringFromErrorNumber(2024)))
frontPanel.appendChild(resetMessage)
}
if(INTERMediatorOnPage.authPanelExp){
breakLine = document.createElement('HR')
frontPanel.appendChild(breakLine)
const addingNode = document.createElement('DIV')
addingNode.className = '_im_auth_exp'
addingNode.innerHTML = INTERMediatorOnPage.authPanelExp
frontPanel.appendChild(addingNode)
}
}
passwordBox.onkeydown = function (event) {
if (event.code === 'Enter') {
@@ -895,6 +905,15 @@ let INTERMediatorOnPage = {
explain.appendChild(document.createTextNode(INTERMediatorLib.getInsertedStringFromErrorNumber(2030)))
frontPanel.appendChild(explain)

if(INTERMediatorOnPage.authPanelExp2FA){
breakLine = document.createElement('HR')
frontPanel.appendChild(breakLine)
const addingNode = document.createElement('DIV')
addingNode.className = '_im_auth_exp_2fa'
addingNode.innerHTML = INTERMediatorOnPage.authPanelExp2FA
frontPanel.appendChild(addingNode)
}

window.scrollTo(0, 0)
codeBox.focus()
INTERMediatorOnPage.authCount++
11 changes: 10 additions & 1 deletion src/php/GenerateJSCode.php
Original file line number Diff line number Diff line change
@@ -349,7 +349,7 @@ public function generateInitialJSCode(?array $dataSource, ?array $options, ?arra
$this->generateAssignJS("INTERMediatorOnPage.realm", $q, $realmValue, $q);
$req2FAValue = $options['authentication']['is-required-2FA']
?? Params::getParameterValue("isRequired2FA", '');
$this->generateAssignJS("INTERMediatorOnPage.isRequired2FA", $req2FAValue? "true" : "false");
$this->generateAssignJS("INTERMediatorOnPage.isRequired2FA", $req2FAValue ? "true" : "false");
$digitsOf2FACodeValue = $options['authentication']['digits-of-2FA-Code']
?? Params::getParameterValue("digitsOf2FACode", 4);
$this->generateAssignJS("INTERMediatorOnPage.digitsOf2FACode", intval($digitsOf2FACodeValue));
@@ -401,6 +401,15 @@ public function generateInitialJSCode(?array $dataSource, ?array $options, ?arra
if ($activateGenerator) {
$this->generateAssignJS("INTERMediatorOnPage.activateMaintenanceCall", "true");
}

$this->generateAssignJS("INTERMediatorOnPage.authPanelTitle",
$q, Params::getParameterValue('authPanelTitle', ""), $q);
$this->generateAssignJS("INTERMediatorOnPage.authPanelTitle2FA", $q,
Params::getParameterValue('authPanelTitle2FA', ""), $q);
$this->generateAssignJS("INTERMediatorOnPage.authPanelExp",
$q, Params::getParameterValue('authPanelExp', ""), $q);
$this->generateAssignJS("INTERMediatorOnPage.authPanelExp2FA",
$q, Params::getParameterValue('authPanelExp2FA', ""), $q);
}

/**
9 changes: 7 additions & 2 deletions themes/default/css/style.css
Original file line number Diff line number Diff line change
@@ -323,7 +323,7 @@ span.IM_POSTMESSAGE {
color: #50506c;
}

#_im_authpback,#_im_authpback_2FA {
#_im_authpback, #_im_authpback_2FA {
position: absolute;
height: 100%;
width: 100%;
@@ -357,7 +357,7 @@ span.IM_POSTMESSAGE {
text-align: center;
}

._im_authlabel,._im_authlabel_2FA {
._im_authlabel, ._im_authlabel_2FA {
text-align: right;
float: left;
color: #bdbdee;
@@ -433,6 +433,11 @@ span.IM_POSTMESSAGE {
color: red;
}

._im_auth_exp_2fa, ._im_auth_exp {
font-size: 85%;
}


/* Widget Pop-up Panel */
._im_widget_popup_panelback {
position: absolute;

0 comments on commit f366922

Please sign in to comment.