Provide a facility for setting an override URL which will replace the Change Password UI, and the Forgotten Password UI with a clickable link.

This commit is contained in:
Paul Waite authored and Andrew Ruthven committed 2022-02-12 14:02:54 +00:00
1 parent 45035ad488
commit dd5bd9c282
3 files changed
+86 -5

No files matched your search

+53
View File
@@ -130,6 +130,59 @@ class DAViCalSession extends Session
}
/**
* Renders some HTML for a basic login panel
*
* @return string The HTML to display a login panel.
*/
function RenderLoginPanel() {
global $c;
$action_target = htmlspecialchars(preg_replace('/\?logout.*$/','',$_SERVER['REQUEST_URI']));
dbg_error_log( "Login", " RenderLoginPanel: action_target='%s'", $action_target );
$userprompt = translate("User Name");
$pwprompt = translate("Password");
$gobutton = htmlspecialchars(translate("GO!"));
$gotitle = htmlspecialchars(translate("Enter your username and password then click here to log in."));
$temppwprompt = translate("If you have forgotten your password then");
$temppwbutton = htmlspecialchars(translate("Help! I've forgotten my password!"));
if (isset($c->password_change_override) ) {
$temppw_html = '<a href="' . $c->password_change_override['href'] . '">' . $c->password_change_override['label'] . '</a>';
} else {
$temppwtitle = htmlspecialchars(translate("Enter a username, if you know it, and click here, to be e-mailed a temporary password."));
$temppw_html = '<input type="submit" value="' . $temppwbutton . '" title="' . $temppwtitle . '" name="lostpass" class="submit" />';
}
$html = <<<EOTEXT
<div id="logon">
<form action="$action_target" method="post">
<table>
<tr>
<th class="prompt">$userprompt:</th>
<td class="entry">
<input class="text" type="text" name="username" size="12" /></td>
</tr>
<tr>
<th class="prompt">$pwprompt:</th>
<td class="entry">
<input class="password" type="password" name="password" size="12" />
</td>
</tr>
<tr>
<th class="prompt">&nbsp;</th>
<td class="entry">
<input type="submit" value="$gobutton" title="$gotitle" name="submit" class="submit" />
</td>
</tr>
</table>
<p>
$temppwprompt: $temppw_html
</p>
</form>
</div>
EOTEXT;
return $html;
}
/**
* Checks that this user is logged in, and presents a login screen if they aren't.