Skip to content

Commit

Permalink
Use class "error" when appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
vargenau committed Mar 1, 2021
1 parent 8b33c72 commit b27a7a3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/plugin/UserPreferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function run($dbi, $argstr, &$request, $basepage)
$args = $this->getArgs($argstr, $request);
$user =& $request->_user;
$user->_request = $request;
$iserror = false;
if (defined('FUSIONFORGE') && FUSIONFORGE) {
if (!($user->isAuthenticated())) {
return HTML::p(array('class' => 'error'),
Expand Down Expand Up @@ -129,6 +130,7 @@ function run($dbi, $argstr, &$request, $basepage)
} elseif ($rp = $request->getArg('pref')) {
// replace only changed prefs in $pref with those from request
if (!empty($rp['passwd']) and ($rp['passwd2'] != $rp['passwd'])) {
$iserror = true;
$errmsg = _("Wrong password. Try again.");
} else {
if (empty($rp['passwd'])) unset($rp['passwd']);
Expand All @@ -148,9 +150,11 @@ function run($dbi, $argstr, &$request, $basepage)
if ($passchanged) {
$errmsg = _("Password updated.") . " ";
} else {
$iserror = true;
$errmsg = _("Password was not changed.") . " ";
}
} else {
$iserror = true;
$errmsg = _("Password cannot be changed.");
}
}
Expand All @@ -167,7 +171,11 @@ function run($dbi, $argstr, &$request, $basepage)
}
}
}
$args['errmsg'] = HTML::div(array('class' => 'feedback'), HTML::p($errmsg));
if ($iserror) {
$args['errmsg'] = HTML::div(array('class' => 'error'), HTML::p($errmsg));
} else {
$args['errmsg'] = HTML::div(array('class' => 'feedback'), HTML::p($errmsg));
}

}
}
Expand Down

0 comments on commit b27a7a3

Please sign in to comment.