Allow custom error messages for the login page

This commit is contained in:
Robin Appelman 2015-01-22 14:13:02 +01:00
parent 857695ec87
commit 8a9acc5083
2 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,11 @@ script('core', [
<small><?php p($l->t('Please contact your administrator.')); ?></small>
</div>
<?php endif; ?>
<?php foreach($_['messages'] as $message): ?>
<div class="warning">
<?php p($message); ?><br>
</div>
<?php endforeach; ?>
<p id="message" class="hidden">
<img class="float-spinner" alt=""
src="<?php p(\OCP\Util::imagePath('core', 'loading-dark.gif'));?>" />

View File

@ -778,12 +778,14 @@ class OC_Util {
/**
* @param array $errors
* @param string[] $messages
*/
public static function displayLoginPage($errors = array()) {
public static function displayLoginPage($errors = array(), $messages = []) {
$parameters = array();
foreach ($errors as $value) {
$parameters[$value] = true;
}
$parameters['messages'] = $messages;
if (!empty($_REQUEST['user'])) {
$parameters["username"] = $_REQUEST['user'];
$parameters['user_autofocus'] = false;