From 7c804bf715deb9c4861c7fe8535108839eb6310f Mon Sep 17 00:00:00 2001 From: MufridaFaraDiani27 Date: Thu, 28 May 2026 14:25:39 +0700 Subject: [PATCH] reset password --- .../Auth/ForgotPasswordController.php | 33 + .../Auth/ResetPasswordController.php | 46 ++ app/Http/Controllers/UlasanController.php | 2 +- app/Providers/AppServiceProvider.php | 28 +- composer.json | 3 +- composer.lock | 2 +- .../views/auth/forgot-password.blade.php | 581 ++---------------- resources/views/auth/reset-password.blade.php | 202 +++++- resources/views/auth/reset-success.blade.php | 40 ++ .../views/emails/reset-password.blade.php | 196 ++++++ resources/views/layouts/sentara.blade.php | 2 +- routes/auth.php | 54 +- routes/web.php | 18 + .../5a7ca1a5955aebc99d08fafed8d8566e.php | 40 ++ .../7d9c5f85ffaf54d07a80af266d96aade.php | 442 ------------- .../bc4cd3286ab3e7fad9f5631387c6dcec.php | 150 +++++ .../d0a85338020b14da4f01751c61e88b86.php | 2 +- 17 files changed, 802 insertions(+), 1039 deletions(-) create mode 100644 app/Http/Controllers/Auth/ForgotPasswordController.php create mode 100644 app/Http/Controllers/Auth/ResetPasswordController.php create mode 100644 resources/views/auth/reset-success.blade.php create mode 100644 resources/views/emails/reset-password.blade.php create mode 100644 storage/framework/views/5a7ca1a5955aebc99d08fafed8d8566e.php delete mode 100644 storage/framework/views/7d9c5f85ffaf54d07a80af266d96aade.php create mode 100644 storage/framework/views/bc4cd3286ab3e7fad9f5631387c6dcec.php diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php new file mode 100644 index 0000000..cd08b9e --- /dev/null +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -0,0 +1,33 @@ +validate([ + 'email' => 'required|email' + ]); + + $status = Password::sendResetLink( + $request->only('email') + ); + + return $status === Password::RESET_LINK_SENT + ? back()->with('status', __($status)) + : back()->withErrors(['email' => __($status)]); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php new file mode 100644 index 0000000..dd77dde --- /dev/null +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -0,0 +1,46 @@ + $token, + 'email' => $request->email + ]); + } + + public function reset(Request $request) + { + $request->validate([ + 'token' => 'required', + 'email' => 'required|email', + 'password' => 'required|min:8|confirmed', + ]); + + $status = Password::reset( + $request->only('email', 'password', 'password_confirmation', 'token'), + function ($user, $password) { + $user->forceFill([ + 'password' => Hash::make($password), + 'remember_token' => Str::random(60), + ])->save(); + } + ); + + // return $status == Password::PASSWORD_RESET + // ? redirect()->route('login')->with('status', 'Password berhasil direset!') + // : back()->withErrors(['email' => [__($status)]]); + return view('auth.reset-success'); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/UlasanController.php b/app/Http/Controllers/UlasanController.php index 746d2fc..ca95dea 100644 --- a/app/Http/Controllers/UlasanController.php +++ b/app/Http/Controllers/UlasanController.php @@ -294,7 +294,7 @@ public function ambilData(Request $request) if (($validated['redirect_to'] ?? 'dashboard') === 'ulasan') { return redirect()->route('ulasan.index', array_filter($redirectParameters)) - ->with('success', 'Data berhasil diambil dan dianalisis untuk ' . $lokasiLabel . ' periode ' . $periodeBulan->translatedFormat('F Y') . '.'); + ->with('success', 'Data berhasil diambil' . $lokasiLabel . ' periode ' . $periodeBulan->translatedFormat('F Y') . '.'); } if (!empty($validated['wisata'])) { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a4254c4..3f2b16c 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,16 +3,28 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; +use Illuminate\Auth\Notifications\ResetPassword; class AppServiceProvider extends ServiceProvider { - public function register(): void - { - // - } - public function boot(): void - { - // - } +{ + ResetPassword::toMailUsing(function ($notifiable, string $token) { + + $url = url(route( + 'password.reset', + [ + 'token' => $token, + 'email' => $notifiable->getEmailForPasswordReset(), + ], + false + )); + + return (new \Illuminate\Notifications\Messages\MailMessage) + ->subject('Reset Password SENTARA') + ->view('emails.reset-password', [ + 'actionUrl' => $url + ]); + }); +} } \ No newline at end of file diff --git a/composer.json b/composer.json index abfee9c..a4d5466 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ "barryvdh/laravel-dompdf": "^3.1", "laravel/framework": "^11.0", "laravel/tinker": "^2.10.1", - "maatwebsite/excel": "^3.1" + "maatwebsite/excel": "^3.1", + "nesbot/carbon": "^3.11" }, "require-dev": { "fakerphp/faker": "^1.23", diff --git a/composer.lock b/composer.lock index 14cba12..ab7f2cb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "855b99e0c7cb480cba79f70700deeb58", + "content-hash": "fceea29907dfa5352acade86e2cf7f27", "packages": [ { "name": "barryvdh/laravel-dompdf", diff --git a/resources/views/auth/forgot-password.blade.php b/resources/views/auth/forgot-password.blade.php index f215bfd..6e3992c 100644 --- a/resources/views/auth/forgot-password.blade.php +++ b/resources/views/auth/forgot-password.blade.php @@ -2,553 +2,70 @@ - Lupa Password - SENTARA - - @vite(['resources/css/app.css','resources/js/app.js']) - - + + - +
-
+
+ -
-
+

+ Lupa Password? +

-
+

+ Masukkan email akun Anda untuk menerima link reset password. +

+
- -
+
- -
+

+ Reset Password +

- +

+ Kami akan mengirim link reset password ke email Anda. +

- + @if (session('status')) +
+ {{ session('status') }} +
+ @endif - - - +
+ @csrf +
+ + +
- -

- Lupa Password? -

+ +
-

- Untuk keamanan akun, pengaturan ulang password hanya dapat dilakukan -
- oleh Administrator. -

- - -
- - - - - - - - - -

- Silakan hubungi Administrator sistem untuk memperbarui password akun Anda. -

- -
- - -
- - - - - - - - - - -

Cara Memperbarui Password

- -
- - -
- -
1
- -
-

Hubungi Administrator

-

- Sampaikan kepada Administrator bahwa Anda lupa password akun SENTARA. -

-
- -
- -
- -
2
- -
-

Verifikasi Identitas

-

- Administrator akan memverifikasi identitas Anda sebagai pengguna sistem. -

-
- -
- -
- -
3
- -
-

Password Baru

-

- Administrator akan membuat password baru dan memberikannya kepada Anda. -

-
- -
- - -
- -
- -
- - - - - - - - - - - -
- -
-

Kontak Administrator

-

- Silakan hubungi administrator melalui kontak resmi berikut: -

-
- -
- -
- - -
- - - - - - - - 0881-0267-1527 - -
- - -
- - - - - - - - - - e31231226@student.polije.ac.id - -
- -
- -
- -
- - - diff --git a/resources/views/auth/reset-password.blade.php b/resources/views/auth/reset-password.blade.php index a6494cc..467a27a 100644 --- a/resources/views/auth/reset-password.blade.php +++ b/resources/views/auth/reset-password.blade.php @@ -1,39 +1,183 @@ - -
- @csrf + + + + + - - +Reset Password - SENTARA + + + + + + + + +
+ + +
-
- - - + + logo + +

+ Buat Password Baru +

+ +

+ Masukkan password baru Anda + pada form di samping. +

+
- -
- - - +
+ 🔐
- -
- +
- + +
- -
+

+ Reset Password +

-
- - {{ __('Reset Password') }} - -
- - +

+ Masukkan password baru untuk akun Anda. +

+ + @if ($errors->any()) +
+ {{ $errors->first() }} +
+ @endif + +
+ + @csrf + + + + + + + + +{{-- Password Baru --}} +
+ + +
+ + + +
+ +

+ Minimal 8 karakter +

+
+ + +{{-- Konfirmasi Password --}} +
+ + +
+ + + +
+
+ + + +
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/resources/views/auth/reset-success.blade.php b/resources/views/auth/reset-success.blade.php new file mode 100644 index 0000000..6d3f965 --- /dev/null +++ b/resources/views/auth/reset-success.blade.php @@ -0,0 +1,40 @@ + + + + + + Password Berhasil Direset + + + + + +
+ +
+
+ + + +
+
+ +

+ Password Berhasil Direset +

+ +

+ Password akun Anda berhasil diperbarui. Silakan login kembali menggunakan password baru. +

+ + + Kembali ke Login + + +
+ + + \ No newline at end of file diff --git a/resources/views/emails/reset-password.blade.php b/resources/views/emails/reset-password.blade.php new file mode 100644 index 0000000..1de85da --- /dev/null +++ b/resources/views/emails/reset-password.blade.php @@ -0,0 +1,196 @@ + + + + + + +Reset Password SENTARA + + + + + + +
+ +
+ +
+ + + +
+Sistem Analisis Sentimen Pariwisata Jember +
+ +
+ + +
+ +
+🔐 +
+ +
+Reset Password +
+ +

+ +Halo,

+ +Kami menerima permintaan reset password untuk akun Anda. +Klik tombol di bawah untuk membuat password baru. + +

+ + +Reset Password + + +
+ +⏰ Link reset password akan kadaluarsa dalam +60 menit. + +

+ +Jika Anda tidak meminta reset password, +abaikan email ini. + +
+ + + + +
+ + + + +
+ +
+ + + \ No newline at end of file diff --git a/resources/views/layouts/sentara.blade.php b/resources/views/layouts/sentara.blade.php index d0004cf..a2cf734 100644 --- a/resources/views/layouts/sentara.blade.php +++ b/resources/views/layouts/sentara.blade.php @@ -14,7 +14,7 @@ -
+