forked from Public/pics
Alerts: replace 'error' class with 'danger'
This commit is contained in:
parent
f9eefe7b41
commit
0366df9b5f
@ -123,7 +123,7 @@ class EditAlbum extends HTMLController
|
|||||||
|
|
||||||
// Anything missing?
|
// Anything missing?
|
||||||
if (!empty($form->getMissing()))
|
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();
|
$data = $form->getData();
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ class EditAlbum extends HTMLController
|
|||||||
$data['kind'] = 'Album';
|
$data['kind'] = 'Album';
|
||||||
$newTag = Tag::createNew($data);
|
$newTag = Tag::createNew($data);
|
||||||
if ($newTag === false)
|
if ($newTag === false)
|
||||||
return $formview->adopt(new Alert('Cannot create this album', 'Something went wrong while creating the album...', 'error'));
|
return $formview->adopt(new Alert('Cannot create this album', 'Something went wrong while creating the album...', 'danger'));
|
||||||
|
|
||||||
if (isset($_POST['submit_and_new']))
|
if (isset($_POST['submit_and_new']))
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ class EditTag extends HTMLController
|
|||||||
|
|
||||||
// Anything missing?
|
// Anything missing?
|
||||||
if (!empty($form->getMissing()))
|
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();
|
$data = $form->getData();
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ class EditTag extends HTMLController
|
|||||||
{
|
{
|
||||||
$return = Tag::createNew($data);
|
$return = Tag::createNew($data);
|
||||||
if ($return === false)
|
if ($return === false)
|
||||||
return $formview->adopt(new Alert('Cannot create this tag', 'Something went wrong while creating the tag...', 'error'));
|
return $formview->adopt(new Alert('Cannot create this tag', 'Something went wrong while creating the tag...', 'danger'));
|
||||||
|
|
||||||
if (isset($_POST['submit_and_new']))
|
if (isset($_POST['submit_and_new']))
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ class EditUser extends HTMLController
|
|||||||
|
|
||||||
// Anything missing?
|
// Anything missing?
|
||||||
if (!empty($form->getMissing()))
|
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();
|
$data = $form->getData();
|
||||||
|
|
||||||
@ -150,18 +150,18 @@ class EditUser extends HTMLController
|
|||||||
|
|
||||||
// If it looks like an e-mail address...
|
// If it looks like an e-mail address...
|
||||||
if (!empty($data['emailaddress']) && !preg_match('~^[^ ]+@[^ ]+\.[a-z]+$~', $data['emailaddress']))
|
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.
|
// 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']))
|
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!
|
// Setting passwords? We'll need two!
|
||||||
if (!$id_user || !empty($data['password1']) && !empty($data['password2']))
|
if (!$id_user || !empty($data['password1']) && !empty($data['password2']))
|
||||||
{
|
{
|
||||||
if (strlen($data['password1']) < 6 || !preg_match('~[^A-z]~', $data['password1']))
|
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'])
|
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
|
else
|
||||||
$data['password'] = $data['password1'];
|
$data['password'] = $data['password1'];
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ class EditUser extends HTMLController
|
|||||||
{
|
{
|
||||||
$return = Member::createNew($data);
|
$return = Member::createNew($data);
|
||||||
if ($return === false)
|
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']))
|
if (isset($_POST['submit_and_new']))
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ class Login extends HTMLController
|
|||||||
parent::__construct('Log in - ' . SITE_TITLE);
|
parent::__construct('Log in - ' . SITE_TITLE);
|
||||||
$form = new LogInForm('Log in');
|
$form = new LogInForm('Log in');
|
||||||
if ($login_error)
|
if ($login_error)
|
||||||
$form->adopt(new Alert('', 'Invalid email address or password.', 'error'));
|
$form->adopt(new Alert('', 'Invalid email address or password.', 'danger'));
|
||||||
|
|
||||||
// Tried anything? Be helpful, at least.
|
// Tried anything? Be helpful, at least.
|
||||||
if (isset($_POST['emailaddress']))
|
if (isset($_POST['emailaddress']))
|
||||||
|
@ -48,7 +48,7 @@ class ResetPassword extends HTMLController
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$form->adopt(new Alert('Some fields require your attention', '<ul><li>' . implode('</li><li>', $missing) . '</li></ul>', 'error'));
|
$form->adopt(new Alert('Some fields require your attention', '<ul><li>' . implode('</li><li>', $missing) . '</li></ul>', 'danger'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -63,7 +63,7 @@ class ResetPassword extends HTMLController
|
|||||||
$id_user = Authentication::getUserid(trim($_POST['emailaddress']));
|
$id_user = Authentication::getUserid(trim($_POST['emailaddress']));
|
||||||
if ($id_user === false)
|
if ($id_user === false)
|
||||||
{
|
{
|
||||||
$form->adopt(new Alert('Invalid email address', 'The email address you provided could not be found in our system. Please try again.', 'error'));
|
$form->adopt(new Alert('Invalid email address', 'The email address you provided could not be found in our system. Please try again.', 'danger'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class Dispatcher
|
|||||||
public static function kickGuest($title = null, $message = null)
|
public static function kickGuest($title = null, $message = null)
|
||||||
{
|
{
|
||||||
$form = new LogInForm('Log in');
|
$form = new LogInForm('Log in');
|
||||||
$form->adopt(new Alert($title ?? '', $message ?? 'You need to be logged in to view this page.', 'error'));
|
$form->adopt(new Alert($title ?? '', $message ?? 'You need to be logged in to view this page.', 'danger'));
|
||||||
$form->setRedirectUrl($_SERVER['REQUEST_URI']);
|
$form->setRedirectUrl($_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
$page = new MainTemplate('Login required');
|
$page = new MainTemplate('Login required');
|
||||||
|
Loading…
Reference in New Issue
Block a user