Skip to content

Commit

Permalink
Corrects all error message stylings
Browse files Browse the repository at this point in the history
  • Loading branch information
ssl committed Jan 30, 2023
1 parent 229e635 commit cc3abea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions app/controllers/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function mfa()
$user = $this->model('User')->login($username, $password);

if (getAuthCode($user['secret']) != $code) {
throw new Exception('Code is incorrect.');
throw new Exception('Code is incorrect');
}

$this->session->createSession($user);
Expand All @@ -168,11 +168,11 @@ private function passwordSettings($currentPassword, $newPassword, $newPassword2)
$user = $this->model('User')->getById($this->session->data('id'));

if (!password_verify($currentPassword, $user['password'])) {
throw new Exception('Current password is not correct.');
throw new Exception('Current password is incorrect');
}

if ($newPassword !== $newPassword2) {
throw new Exception('The retyped password is not the same as the new password.');
throw new Exception('The retyped password is not the same as the new password');
}

$this->model('User')->setPassword($user['id'], $newPassword);
Expand All @@ -193,7 +193,7 @@ private function mfaSettings($secret, $code)

if (strlen($secret) == 16) {
if (strlen($secretCode) === 16) {
throw new Exception('2FA settings are already enabled.');
throw new Exception('2FA settings are already enabled');
}

if (strlen($secret) !== 16) {
Expand All @@ -205,11 +205,11 @@ private function mfaSettings($secret, $code)
}
} else {
if (strlen($secretCode) !== 16) {
throw new Exception('2FA settings are already disabled.');
throw new Exception('2FA settings are already disabled');
}

if (getAuthCode($secretCode) != $code) {
throw new Exception('Code is incorrect.');
throw new Exception('Code is incorrect');
}
$secret = '';
}
Expand All @@ -232,7 +232,7 @@ private function alertSettings()
$mailOn = $this->getPostValue('mailon');
$mail = $this->getPostValue('mail');
if (!filter_var($mail, FILTER_VALIDATE_EMAIL) && !empty($mail)) {
throw new Exception('This is not a correct email address.');
throw new Exception('This is not a correct email address');
}
$alerts->set($user['id'], 1, $mailOn !== null, $mail);

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getAlertStatus()
$alertId = $this->getPostValue('alertId');

if (!is_string($alertId) || !isset($alertIds[$alertId])) {
throw new Exception("Invalid alert");
throw new Exception('Invalid alert');
}

$enabled = $this->model('Setting')->get('alert-' . $alertIds[$alertId]);
Expand Down Expand Up @@ -62,7 +62,7 @@ public function getChatId()

// Check if result is OK
if ($results['ok'] !== true) {
return $this->showEcho('Something went wrong. Your bot token is probably invalid.');
return $this->showEcho('Something went wrong, your bot token is probably invalid');
}

// Check if result contains any chat
Expand All @@ -88,7 +88,7 @@ public function getMostCommon()

// Validate if id and row is correct
if (!in_array($id, [1, 2, 3, 4, 5]) || !in_array($row, [1, 2])) {
return $this->showEcho('Something went wrong.');
return $this->showEcho('Something went wrong');
}

// Save row/id combination of user
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ private function applicationSettings($timezone, $theme, $filter, $dompart)
{
// Validate timezone
if (!in_array($timezone, timezone_identifiers_list(), true)) {
throw new Exception('The timezone is not a valid timezone.');
throw new Exception('The timezone is not a valid timezone');
}

// Validate if theme exists
$theme = preg_replace('/[^a-zA-Z0-9]/', '', $theme);
if (!file_exists(__DIR__ . "/../../assets/css/{$theme}.css")) {
throw new Exception('This theme is not installed.');
throw new Exception('This theme is not installed');
}

// Check if type is digit
if (!ctype_digit($dompart)) {
throw new Exception('The dom length needs to be digits.');
throw new Exception('The dom length needs to be digits');
}

// Set the value based on the posted filter
Expand Down Expand Up @@ -195,7 +195,7 @@ private function alertSettings()
$mailOn = $this->getPostValue('mailon');
$mail = $this->getPostValue('mail');
if (!filter_var($mail, FILTER_VALIDATE_EMAIL) && !empty($mail)) {
throw new Exception('This is not a correct email address.');
throw new Exception('This is not a correct email address');
}
$alerts->set(0, 1, $mailOn !== null, $mail);

Expand Down

0 comments on commit cc3abea

Please sign in to comment.