diff --git a/backend/app/Mail/LoginNotificationMail.php b/backend/app/Mail/LoginNotificationMail.php new file mode 100644 index 00000000..809d46da --- /dev/null +++ b/backend/app/Mail/LoginNotificationMail.php @@ -0,0 +1,40 @@ + $request->national_id, 'address' => $request->address, 'postal_code' => $request->postal_code, - 'account_number' => $request->account_number, 'phone_number' => $request->phone_number, 'province_id' => $request->province_id, 'city_id' => $request->city_id, + 'status' => 1 ]); return $this->successResponse(); diff --git a/backend/app/User/Events/LoginEmailEvent.php b/backend/app/User/Events/LoginEmailEvent.php new file mode 100755 index 00000000..f3199341 --- /dev/null +++ b/backend/app/User/Events/LoginEmailEvent.php @@ -0,0 +1,23 @@ +user; + + Mail::to($user->email)->send( + new LoginNotificationMail($user) + ); + } +} diff --git a/backend/app/User/Requests/Profile/EditRequest.php b/backend/app/User/Requests/Profile/EditRequest.php index ddcfcba8..4eb93a4e 100644 --- a/backend/app/User/Requests/Profile/EditRequest.php +++ b/backend/app/User/Requests/Profile/EditRequest.php @@ -28,8 +28,7 @@ class EditRequest extends FormRequest 'national_id' => 'required', 'address' => 'required', 'postal_code' => 'required', - 'account_number' => 'required', - 'phone_number' => 'required|regex:/^964\d{9}$/|numeric|digits:11', + 'phone_number' => 'required', 'province_id' => 'required', 'city_id' => 'required', ]; diff --git a/backend/bootstrap/app.php b/backend/bootstrap/app.php index 68a86469..f8d2c617 100755 --- a/backend/bootstrap/app.php +++ b/backend/bootstrap/app.php @@ -16,4 +16,7 @@ return Application::configure(basePath: dirname(__DIR__)) }) ->withExceptions(function (Exceptions $exceptions): void { // - })->create(); + }) + ->withEvents(discover: [ + __DIR__.'/../app/User/Listeners', + ])->create(); diff --git a/backend/resources/views/emails/login-notification.blade.php b/backend/resources/views/emails/login-notification.blade.php new file mode 100644 index 00000000..035c3c5c --- /dev/null +++ b/backend/resources/views/emails/login-notification.blade.php @@ -0,0 +1,24 @@ + + +
+ +You have successfully logged in to your account.
+ ++ Email: {{ $user->email }} +
+ ++ If this login was not done by you, please contact support immediately. +
+ +Thank you.
+ +