Alerts: replace 'error' class with 'danger'

This commit is contained in:
2023-03-11 13:30:02 +01:00
parent f9eefe7b41
commit 0366df9b5f
6 changed files with 14 additions and 14 deletions

View File

@@ -129,7 +129,7 @@ class EditUser extends HTMLController
// Anything missing?
if (!empty($form->getMissing()))
return $formview->adopt(new Alert('Some data missing', 'Please fill out the following fields: ' . implode(', ', $form->getMissing()), 'error'));
return $formview->adopt(new Alert('Some data missing', 'Please fill out the following fields: ' . implode(', ', $form->getMissing()), 'danger'));
$data = $form->getData();
@@ -150,18 +150,18 @@ class EditUser extends HTMLController
// If it looks like an e-mail address...
if (!empty($data['emailaddress']) && !preg_match('~^[^ ]+@[^ ]+\.[a-z]+$~', $data['emailaddress']))
return $formview->adopt(new Alert('Email addresses invalid', 'The email address you entered is not a valid email address.', 'error'));
return $formview->adopt(new Alert('Email addresses invalid', 'The email address you entered is not a valid email address.', 'danger'));
// Check whether email address is already linked to an account in the database -- just not to the account we happen to be editing, of course.
elseif (!empty($data['emailaddress']) && Member::exists($data['emailaddress']) && !($id_user && $user->getEmailAddress() == $data['emailaddress']))
return $formview->adopt(new Alert('Email address already in use', 'Another account is already using the e-mail address you entered.', 'error'));
return $formview->adopt(new Alert('Email address already in use', 'Another account is already using the e-mail address you entered.', 'danger'));
// Setting passwords? We'll need two!
if (!$id_user || !empty($data['password1']) && !empty($data['password2']))
{
if (strlen($data['password1']) < 6 || !preg_match('~[^A-z]~', $data['password1']))
return $formview->adopt(new Alert('Password not acceptable', 'Please fill in a password that is at least six characters long and contains at least one non-alphabetic character (e.g. a number or symbol).', 'error'));
return $formview->adopt(new Alert('Password not acceptable', 'Please fill in a password that is at least six characters long and contains at least one non-alphabetic character (e.g. a number or symbol).', 'danger'));
elseif ($data['password1'] !== $data['password2'])
return $formview->adopt(new Alert('Passwords do not match', 'The passwords you entered do not match. Please try again.', 'error'));
return $formview->adopt(new Alert('Passwords do not match', 'The passwords you entered do not match. Please try again.', 'danger'));
else
$data['password'] = $data['password1'];
@@ -173,7 +173,7 @@ class EditUser extends HTMLController
{
$return = Member::createNew($data);
if ($return === false)
return $formview->adopt(new Alert('Cannot create this user', 'Something went wrong while creating the user...', 'error'));
return $formview->adopt(new Alert('Cannot create this user', 'Something went wrong while creating the user...', 'danger'));
if (isset($_POST['submit_and_new']))
{