Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
  • mv-sso-code-to-utils
  • renovate/commitlint-monorepo
  • renovate/lock-file-maintenance
  • v3.0.0
  • v3.0.1
  • v3.0.2
  • v4.0.0
  • v4.0.1
  • v4.1.0
  • v4.1.1
  • v5.0.0
  • v5.0.1
  • v5.1.0
  • v5.2.0
  • v5.3.0
  • v5.3.1
  • v5.3.2
  • v5.4.0
  • v5.4.1
  • v5.4.2
  • v5.5.0
  • v5.5.1
  • v5.5.2
  • v5.5.3
  • v6.0.0
26 results

Target

Select target project
  • perun/perun-proxyidp/simplesamlphp-module-privacyidea
1 result
Select Git revision
  • main
  • mv-sso-code-to-utils
  • renovate/commitlint-monorepo
  • renovate/lock-file-maintenance
  • v3.0.0
  • v3.0.1
  • v3.0.2
  • v4.0.0
  • v4.0.1
  • v4.1.0
  • v4.1.1
  • v5.0.0
  • v5.0.1
  • v5.1.0
  • v5.2.0
  • v5.3.0
  • v5.3.1
  • v5.3.2
  • v5.4.0
  • v5.4.1
  • v5.4.2
  • v5.5.0
  • v5.5.1
  • v5.5.2
  • v5.5.3
  • v6.0.0
26 results
Show changes
<?php declare(strict_types=1); <?php
declare(strict_types=1);
use SimpleSAML\Module; use SimpleSAML\Module;
...@@ -15,11 +17,8 @@ if ($this->data['errorCode'] !== null) { ...@@ -15,11 +17,8 @@ if ($this->data['errorCode'] !== null) {
?> ?>
<div class="error-dialog"> <div class="error-dialog">
<img src="/<?php <img src="/<?php echo htmlspecialchars($this->data['baseurlpath'], ENT_QUOTES);
echo htmlspecialchars( ?>resources/icons/experience/gtk-dialog-error.48x48.png"
$this->data['baseurlpath'],
ENT_QUOTES
); ?>resources/icons/experience/gtk-dialog-error.48x48.png"
class="float-l erroricon" alt="gtk-dialog-error"/> class="float-l erroricon" alt="gtk-dialog-error"/>
<h2><?php echo $this->t('{login:error_header}'); ?></h2> <h2><?php echo $this->t('{login:error_header}'); ?></h2>
<p> <p>
...@@ -46,7 +45,7 @@ if ($this->data['errorCode'] !== null) { ...@@ -46,7 +45,7 @@ if ($this->data['errorCode'] !== null) {
} elseif ($this->data['step'] < 2) { } elseif ($this->data['step'] < 2) {
echo '<h2>' . htmlspecialchars($this->t('{privacyidea:privacyidea:login_title}')) . '</h2>'; echo '<h2>' . htmlspecialchars($this->t('{privacyidea:privacyidea:login_title}')) . '</h2>';
} }
?> ?>
<form action="FormReceiver.php" method="POST" id="piLoginForm" name="piLoginForm" class="loginForm"> <form action="FormReceiver.php" method="POST" id="piLoginForm" name="piLoginForm" class="loginForm">
<div class="form-panel first valid" id="gaia_firstform"> <div class="form-panel first valid" id="gaia_firstform">
...@@ -54,54 +53,58 @@ if ($this->data['errorCode'] !== null) { ...@@ -54,54 +53,58 @@ if ($this->data['errorCode'] !== null) {
<div class="input-wrapper focused"> <div class="input-wrapper focused">
<div class="identifier-shown"> <div class="identifier-shown">
<?php <?php
if ($this->data['forceUsername']) { if ($this->data['forceUsername']) {
if (!empty($this->data['username'])) { if (!empty($this->data['username'])) {
?> ?>
<h3><?php echo htmlspecialchars($this->data['username']); ?></h3> <h3><?php echo htmlspecialchars($this->data['username']); ?></h3>
<?php <?php
} ?> } ?>
<input type="hidden" id="username" name="username" <input type="hidden" id="username" name="username"
value="<?php echo htmlspecialchars($this->data['username'] ?? '', ENT_QUOTES); ?>"/> value="<?php
echo htmlspecialchars($this->data['username'] ?? '', ENT_QUOTES); ?>"/>
<?php <?php
} elseif ($this->data['step'] <= 1) { } elseif ($this->data['step'] <= 1) {
?> ?>
<p> <p>
<label for="username" class="sr-only"> <label for="username" class="sr-only">
<?php echo $this->t('{login:username}'); ?> <?php echo $this->t('{login:username}'); ?>
</label> </label>
<input type="text" id="username" tabindex="1" name="username" autofocus <input type="text" id="username" tabindex="1" name="username" autofocus
value="<?php echo htmlspecialchars($this->data['username'], ENT_QUOTES); ?>" value="<?php
placeholder="<?php echo htmlspecialchars($this->t('{login:username}'), ENT_QUOTES); ?>" echo htmlspecialchars($this->data['username'], ENT_QUOTES); ?>"
placeholder="<?php
echo htmlspecialchars($this->t('{login:username}'), ENT_QUOTES); ?>"
/> />
</p> </p>
<?php <?php
} }
// Remember username in authproc // Remember username in authproc
if (!$this->data['authProcFilterScenario']) { if (!$this->data['authProcFilterScenario']) {
if ($this->data['rememberUsernameEnabled'] || $this->data['rememberMeEnabled']) { if ($this->data['rememberUsernameEnabled'] || $this->data['rememberMeEnabled']) {
$rowspan = 1; $rowspan = 1;
} elseif (array_key_exists('organizations', $this->data)) { } elseif (array_key_exists('organizations', $this->data)) {
$rowspan = 3; $rowspan = 3;
} else { } else {
$rowspan = 2; $rowspan = 2;
} }
if ($this->data['rememberUsernameEnabled'] || $this->data['rememberMeEnabled']) { if ($this->data['rememberUsernameEnabled'] || $this->data['rememberMeEnabled']) {
if ($this->data['rememberUsernameEnabled']) { if ($this->data['rememberUsernameEnabled']) {
echo str_repeat("\t", 4); echo str_repeat("\t", 4);
echo '<input type="checkbox" id="rememberUsername" tabindex="4" name="rememberUsername" echo '<input type="checkbox" id="rememberUsername" tabindex="4"'
value="Yes" '; . ' name="rememberUsername" value="Yes" ';
echo $this->data['rememberUsernameChecked'] ? 'checked="Yes" /> ' : '/> '; echo $this->data['rememberUsernameChecked'] ? 'checked="Yes" /> ' : '/> ';
echo htmlspecialchars($this->t('{login:remember_username}')); echo htmlspecialchars($this->t('{login:remember_username}'));
} }
if ($this->data['rememberMeEnabled']) { if ($this->data['rememberMeEnabled']) {
echo str_repeat("\t", 4); echo str_repeat("\t", 4);
echo '<input type="checkbox" id="rememberMe" tabindex="4" name="rememberMe" value="Yes" '; echo '<input type="checkbox" id="rememberMe" tabindex="4"'
echo $this->data['rememberMeChecked'] ? 'checked="Yes" /> ' : '/> '; . ' name="rememberMe" value="Yes" ';
echo htmlspecialchars($this->t('{login:remember_me}')); echo $this->data['rememberMeChecked'] ? 'checked="Yes" /> ' : '/> ';
} echo htmlspecialchars($this->t('{login:remember_me}'));
} }
} ?> }
} ?>
<!-- Pass and OTP fields --> <!-- Pass and OTP fields -->
<?php if (!$this->data['authProcFilterScenario']) { ?> <?php if (!$this->data['authProcFilterScenario']) { ?>
...@@ -109,21 +112,22 @@ if ($this->data['errorCode'] !== null) { ...@@ -109,21 +112,22 @@ if ($this->data['errorCode'] !== null) {
<?php echo $this->t('{privacyidea:privacyidea:password}'); ?> <?php echo $this->t('{privacyidea:privacyidea:password}'); ?>
</label> </label>
<input id="password" name="password" tabindex="1" type="password" value="" class="text" <input id="password" name="password" tabindex="1" type="password" value="" class="text"
placeholder="<?php echo htmlspecialchars($this->data['passHint'], ENT_QUOTES); ?>"/> placeholder="<?php
echo htmlspecialchars($this->data['passHint'], ENT_QUOTES); ?>"/>
<?php } ?> <?php } ?>
<?php if ($this->data['step'] > 1) { ?> <?php if ($this->data['step'] > 1) { ?>
<p id="message" role="alert"><?php <p id="message" role="alert"><?php
$messageOverride = $this->data['messageOverride'] ?? null; $messageOverride = $this->data['messageOverride'] ?? null;
if ($messageOverride === null || is_string($messageOverride)) { if ($messageOverride === null || is_string($messageOverride)) {
echo htmlspecialchars( echo htmlspecialchars(
$messageOverride ?? $this->data['message'] ?? '', $messageOverride ?? $this->data['message'] ?? '',
ENT_QUOTES ENT_QUOTES
); );
} elseif (is_callable($messageOverride)) { } elseif (is_callable($messageOverride)) {
echo call_user_func($messageOverride, $this->data['message'] ?? ''); echo call_user_func($messageOverride, $this->data['message'] ?? '');
} }
?></p> ?></p>
<?php } ?> <?php } ?>
<?php if ($this->data['step'] > 1) { ?> <?php if ($this->data['step'] > 1) { ?>
...@@ -131,7 +135,8 @@ if ($this->data['errorCode'] !== null) { ...@@ -131,7 +135,8 @@ if ($this->data['errorCode'] !== null) {
<label for="otp" class="sr-only"> <label for="otp" class="sr-only">
<?php echo $this->t('{privacyidea:privacyidea:otp}'); ?> <?php echo $this->t('{privacyidea:privacyidea:otp}'); ?>
</label> </label>
<input id="otp" name="otp" type="password" placeholder="<?php echo htmlspecialchars($this->data['otpHint'], ENT_QUOTES); ?>" <input id="otp" name="otp" type="password" placeholder="<?php
echo htmlspecialchars($this->data['otpHint'], ENT_QUOTES); ?>"
<?php if (($this->data['otpAvailable'] ?? true) && $this->data['noAlternatives']) { <?php if (($this->data['otpAvailable'] ?? true) && $this->data['noAlternatives']) {
echo ' autofocus'; echo ' autofocus';
} ?>> } ?>>
...@@ -139,14 +144,16 @@ if ($this->data['errorCode'] !== null) { ...@@ -139,14 +144,16 @@ if ($this->data['errorCode'] !== null) {
<?php } ?> <?php } ?>
<p> <p>
<button id="submitButton" tabindex="1" class="rc-button rc-button-submit" type="submit" name="Submit" value="1"> <button id="submitButton" tabindex="1" class="rc-button rc-button-submit"
type="submit" name="Submit" value="1">
<?php echo htmlspecialchars($this->t('{login:login_button}'), ENT_QUOTES); ?> <?php echo htmlspecialchars($this->t('{login:login_button}'), ENT_QUOTES); ?>
</button> </button>
</p> </p>
<!-- Undefined index is suppressed and the default is used for these values --> <!-- Undefined index is suppressed and the default is used for these values -->
<input id="mode" type="hidden" name="mode" value="otp" <input id="mode" type="hidden" name="mode" value="otp"
data-preferred="<?php echo htmlspecialchars($this->data['mode'], ENT_QUOTES); ?>"/> data-preferred="<?php
echo htmlspecialchars($this->data['mode'], ENT_QUOTES); ?>"/>
<input id="pushAvailable" type="hidden" name="pushAvailable" <input id="pushAvailable" type="hidden" name="pushAvailable"
value="<?php echo ($this->data['pushAvailable'] ?? false) ? 'true' : ''; ?>"/> value="<?php echo ($this->data['pushAvailable'] ?? false) ? 'true' : ''; ?>"/>
...@@ -155,35 +162,45 @@ if ($this->data['errorCode'] !== null) { ...@@ -155,35 +162,45 @@ if ($this->data['errorCode'] !== null) {
value="<?php echo ($this->data['otpAvailable'] ?? true) ? 'true' : ''; ?>"/> value="<?php echo ($this->data['otpAvailable'] ?? true) ? 'true' : ''; ?>"/>
<input id="webAuthnSignRequest" type="hidden" name="webAuthnSignRequest" <input id="webAuthnSignRequest" type="hidden" name="webAuthnSignRequest"
value='<?php echo htmlspecialchars($this->data['webAuthnSignRequest'] ?? '', ENT_QUOTES); ?>'/> value='<?php
echo htmlspecialchars($this->data['webAuthnSignRequest'] ?? '', ENT_QUOTES);
?>'/>
<input id="u2fSignRequest" type="hidden" name="u2fSignRequest" <input id="u2fSignRequest" type="hidden" name="u2fSignRequest"
value='<?php echo htmlspecialchars($this->data['u2fSignRequest'] ?? '', ENT_QUOTES); ?>'/> value='<?php
echo htmlspecialchars($this->data['u2fSignRequest'] ?? '', ENT_QUOTES); ?>'/>
<input id="modeChanged" type="hidden" name="modeChanged" value=""/> <input id="modeChanged" type="hidden" name="modeChanged" value=""/>
<input id="step" type="hidden" name="step" <input id="step" type="hidden" name="step"
value="<?php echo htmlspecialchars(strval(($this->data['step'] ?? null) ?: 2), ENT_QUOTES); ?>"/> value="<?php
echo htmlspecialchars(strval(($this->data['step'] ?? null) ?: 2), ENT_QUOTES);
?>"/>
<input id="webAuthnSignResponse" type="hidden" name="webAuthnSignResponse" value=""/> <input id="webAuthnSignResponse" type="hidden" name="webAuthnSignResponse" value=""/>
<input id="u2fSignResponse" type="hidden" name="u2fSignResponse" value=""/> <input id="u2fSignResponse" type="hidden" name="u2fSignResponse" value=""/>
<input id="origin" type="hidden" name="origin" value=""/> <input id="origin" type="hidden" name="origin" value=""/>
<input id="loadCounter" type="hidden" name="loadCounter" <input id="loadCounter" type="hidden" name="loadCounter"
value="<?php echo htmlspecialchars(strval(($this->data['loadCounter'] ?? null) ?: 1), ENT_QUOTES); ?>"/> value="<?php
echo htmlspecialchars(
strval(($this->data['loadCounter'] ?? null) ?: 1),
ENT_QUOTES
); ?>"/>
<!-- Additional input to persist the message --> <!-- Additional input to persist the message -->
<input type="hidden" name="message" <input type="hidden" name="message"
value="<?php echo htmlspecialchars($this->data['message'] ?? '', ENT_QUOTES); ?>"/> value="<?php
echo htmlspecialchars($this->data['message'] ?? '', ENT_QUOTES); ?>"/>
<?php <?php
// If enrollToken load QR Code // If enrollToken load QR Code
if (isset($this->data['tokenQR'])) { if (isset($this->data['tokenQR'])) {
echo htmlspecialchars($this->t('{privacyidea:privacyidea:scan_token_qr}')); ?> echo htmlspecialchars($this->t('{privacyidea:privacyidea:scan_token_qr}')); ?>
<div class="tokenQR"> <div class="tokenQR">
<?php echo '<img src="' . $this->data['tokenQR'] . '" />'; ?> <?php echo '<img src="' . $this->data['tokenQR'] . '" />'; ?>
</div> </div>
<?php <?php
} }
?> ?>
</div> </div>
<?php <?php
...@@ -191,7 +208,8 @@ if ($this->data['errorCode'] !== null) { ...@@ -191,7 +208,8 @@ if ($this->data['errorCode'] !== null) {
if (array_key_exists('organizations', $this->data)) { if (array_key_exists('organizations', $this->data)) {
?> ?>
<div class="identifier-shown"> <div class="identifier-shown">
<label for="organization"><?php echo htmlspecialchars($this->t('{login:organization}')); ?></label> <label for="organization"><?php
echo htmlspecialchars($this->t('{login:organization}')); ?></label>
<select id="organization" name="organization" tabindex="3"> <select id="organization" name="organization" tabindex="3">
<?php <?php
if (array_key_exists('selectedOrg', $this->data)) { if (array_key_exists('selectedOrg', $this->data)) {
...@@ -200,25 +218,25 @@ if ($this->data['errorCode'] !== null) { ...@@ -200,25 +218,25 @@ if ($this->data['errorCode'] !== null) {
$selectedOrg = null; $selectedOrg = null;
} }
foreach ($this->data['organizations'] as $orgId => $orgDesc) { foreach ($this->data['organizations'] as $orgId => $orgDesc) {
if (is_array($orgDesc)) { if (is_array($orgDesc)) {
$orgDesc = $this->t($orgDesc); $orgDesc = $this->t($orgDesc);
} }
if ($orgId === $selectedOrg) { if ($orgId === $selectedOrg) {
$selected = 'selected="selected" '; $selected = 'selected="selected" ';
} else { } else {
$selected = ''; $selected = '';
} }
echo '<option ' . $selected . 'value="' . htmlspecialchars( echo '<option ' . $selected . 'value="' . htmlspecialchars(
$orgId, $orgId,
ENT_QUOTES ENT_QUOTES
) . '">' . htmlspecialchars($orgDesc) . '</option>'; ) . '">' . htmlspecialchars($orgDesc) . '</option>';
} ?> } ?>
</select> </select>
</div> </div>
<?php <?php
} ?> } ?>
</div> <!-- focused --> </div> <!-- focused -->
</div> <!-- slide-out--> </div> <!-- slide-out-->
...@@ -256,7 +274,8 @@ if ($this->data['errorCode'] !== null) { ...@@ -256,7 +274,8 @@ if ($this->data['errorCode'] !== null) {
// Logout // Logout
if (($this->data['showLogout'] ?? true) && isset($this->data['LogoutURL'])) { ?> if (($this->data['showLogout'] ?? true) && isset($this->data['LogoutURL'])) { ?>
<p> <p>
<a href="<?php echo htmlspecialchars($this->data['LogoutURL']); ?>"><?php echo $this->t('{status:logout}'); ?></a> <a href="<?php
echo htmlspecialchars($this->data['LogoutURL']); ?>"><?php echo $this->t('{status:logout}'); ?></a>
</p> </p>
<?php } ?> <?php } ?>
</div> <!-- End of login --> </div> <!-- End of login -->
...@@ -282,7 +301,8 @@ if (!empty($this->data['links'])) { ...@@ -282,7 +301,8 @@ if (!empty($this->data['links'])) {
<meta id="privacyidea-step" name="privacyidea-step" content="<?php echo $this->data['step']; ?>"> <meta id="privacyidea-step" name="privacyidea-step" content="<?php echo $this->data['step']; ?>">
<meta id="privacyidea-translations" name="privacyidea-translations" content="<?php echo htmlspecialchars(json_encode($this->data['translations'])); ?>"> <meta id="privacyidea-translations" name="privacyidea-translations" content="<?php
echo htmlspecialchars(json_encode($this->data['translations'])); ?>">
<script src="<?php echo htmlspecialchars(Module::getModuleUrl('privacyidea/js/loginform.js'), ENT_QUOTES); ?>"> <script src="<?php echo htmlspecialchars(Module::getModuleUrl('privacyidea/js/loginform.js'), ENT_QUOTES); ?>">
</script> </script>
......
...@@ -38,7 +38,10 @@ $tpl = new Template(Configuration::getInstance(), 'privacyidea:LoginForm.php'); ...@@ -38,7 +38,10 @@ $tpl = new Template(Configuration::getInstance(), 'privacyidea:LoginForm.php');
$tpl->data['errorCode'] = null; $tpl->data['errorCode'] = null;
$tpl->data['errorMessage'] = null; $tpl->data['errorMessage'] = null;
if (!empty($state['privacyidea:privacyidea']['errorCode']) || !empty($state['privacyidea:privacyidea']['errorMessage'])) { if (
!empty($state['privacyidea:privacyidea']['errorCode'])
|| !empty($state['privacyidea:privacyidea']['errorMessage'])
) {
$tpl->data['errorCode'] = ($state['privacyidea:privacyidea']['errorCode'] ?? null) ?: ''; $tpl->data['errorCode'] = ($state['privacyidea:privacyidea']['errorCode'] ?? null) ?: '';
$state['privacyidea:privacyidea']['errorCode'] = ''; $state['privacyidea:privacyidea']['errorCode'] = '';
$tpl->data['errorMessage'] = $tpl->t('{privacyidea:privacyidea:error_message}'); $tpl->data['errorMessage'] = $tpl->t('{privacyidea:privacyidea:error_message}');
......
...@@ -79,7 +79,8 @@ if ($state['privacyidea:privacyidea']['authenticationMethod'] === 'authprocess') ...@@ -79,7 +79,8 @@ if ($state['privacyidea:privacyidea']['authenticationMethod'] === 'authprocess')
$params = $sessionHandler->getCookieParams(); $params = $sessionHandler->getCookieParams();
$params['expire'] = time(); $params['expire'] = time();
$params['expire'] += (isset($_REQUEST['rememberUsername']) && $_REQUEST['rememberUsername'] === 'Yes' ? 31536000 : -300); $params['expire'] += (isset($_REQUEST['rememberUsername']) && $_REQUEST['rememberUsername'] === 'Yes'
? 31536000 : -300);
HTTP::setCookie($source->getAuthId() . '-username', $username, $params, false); HTTP::setCookie($source->getAuthId() . '-username', $username, $params, false);
} }
......