Skip to content

Commit 2595a5d

Browse files
committed
Standardize success and error messages for consistency
1 parent c179612 commit 2595a5d

6 files changed

Lines changed: 22 additions & 13 deletions

File tree

app/Livewire/Passport/CreateClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function createPassportClient(): void
6565

6666
$this->dispatch('toastify', [
6767
'type' => 'success',
68-
'message' => 'Client Created Successfully!'
68+
'message' => 'Client created successfully!'
6969
]);
7070

7171
$this->reset();

app/Livewire/Passport/Home.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ public function deletePassportClient(string $clientId)
4848

4949
$this->dispatch('toastify', [
5050
'type' => 'success',
51-
'message' => 'Client Deleted Successfully!'
51+
'message' => 'Client deleted successfully!'
5252
]);
5353
} catch (Exception $e) {
5454
$this->dispatch('toastify', [
5555
'type' => 'error',
56-
'message' => 'Client Data Does Not Match!'
56+
'message' => 'Client data does not match!'
5757
]);
5858
}
5959
}
@@ -69,12 +69,12 @@ public function deletePassportClientToken(string $clientId)
6969

7070
$this->dispatch('toastify', [
7171
'type' => 'success',
72-
'message' => 'Client Token Cleared Successfully!'
72+
'message' => 'Client token cleared successfully!'
7373
]);
7474
} catch (Exception $error) {
7575
$this->dispatch('toastify', [
7676
'type' => 'error',
77-
'message' => 'Client Data Does Not Match!'
77+
'message' => 'Client data does not match!'
7878
]);
7979
}
8080
}

app/Livewire/Profile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function updateProfileInformation(): void
114114

115115
$this->dispatch('toastify', [
116116
'type' => 'success',
117-
'message' => 'Profile Updated Successfully!'
117+
'message' => 'Profile updated successfully!'
118118
]);
119119
}
120120

app/Livewire/Security/Home.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function updatePassword(): void
7878

7979
$this->dispatch('toastify', [
8080
'type' => 'success',
81-
'message' => 'Password Updated Successfully!'
81+
'message' => 'Password updated successfully!'
8282
]);
8383
} catch (ValidationException $error) {
8484
$this->reset('current_password', 'password', 'password_confirmation');

app/Livewire/Security/TwoFactor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function enableTwoFactor(ConfirmTwoFactorAuthentication $confirmTwoFactor
110110

111111
$this->dispatch('toastify', [
112112
'type' => 'success',
113-
'message' => 'Two-Factor Setup Successfully'
113+
'message' => 'Two-Factor setup successfully'
114114
]);
115115
} catch (Exception $error) {
116116
$this->dispatch('toastify', [
@@ -130,7 +130,7 @@ public function disableTwoFactor(DisableTwoFactorAuthentication $disableTwoFacto
130130

131131
Session::regenerate();
132132

133-
Session::flash('status', 'Two-Factor Disable Successfully');
133+
Session::flash('status', 'Two-Factor disable successfully');
134134

135135
$this->redirectRoute('security', navigate: true);
136136
}

app/Livewire/Users/Profile.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,23 @@ public function updateProfileInformation(): void
105105
$this->user->fill($validated);
106106

107107
if ($this->user->isDirty('email')) {
108+
if (is_null($this->user->email_verified_at)) {
109+
$this->dispatch('toastify', [
110+
'type' => 'error',
111+
'message' => 'Can\'t change email for unverified user!'
112+
]);
113+
114+
return;
115+
}
116+
108117
$this->user->email_verified_at = null;
109118
}
110119

111120
$this->user->save();
112121

113122
$this->dispatch('toastify', [
114123
'type' => 'success',
115-
'message' => 'User Profile Updated Successfully!'
124+
'message' => 'User profile updated successfully!'
116125
]);
117126
}
118127

@@ -133,7 +142,7 @@ public function unlinkSocialAccount(string $provider): void
133142

134143
$this->dispatch('toastify', [
135144
'type' => 'success',
136-
'message' => 'Social Account Unlinked Successfully!'
145+
'message' => 'Social Account unlinked successfully!'
137146
]);
138147
}
139148
}
@@ -146,7 +155,7 @@ public function disableTwoFactor(DisableTwoFactorAuthentication $disableTwoFacto
146155

147156
$this->dispatch('toastify', [
148157
'type' => 'success',
149-
'message' => 'Two-Factor Disable Successfully!'
158+
'message' => 'Two-Factor disable successfully!'
150159
]);
151160
}
152161

@@ -158,7 +167,7 @@ public function deleteAccount(): void
158167

159168
$this->user->delete();
160169

161-
Session::flash('status', 'User Deleted Successfully');
170+
Session::flash('status', 'User deleted successfully');
162171

163172
$this->redirectRoute('users.home', navigate: true);
164173
}

0 commit comments

Comments
 (0)