diff --git a/app/Http/Controllers/NewPasswordController.php b/app/Http/Controllers/NewPasswordController.php
new file mode 100644
index 0000000..e7e01c4
--- /dev/null
+++ b/app/Http/Controllers/NewPasswordController.php
@@ -0,0 +1,45 @@
+ $request, 'token' => $token]);
+ }
+
+ public function store(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)
+ ])->setRememberToken(Str::random(60));
+
+ $user->save();
+
+ event(new PasswordReset($user));
+ }
+ );
+
+ if ($status == Password::PASSWORD_RESET) {
+ return redirect()->route('login')->with('status', __($status));
+ }
+
+ return back()->withErrors(['email' => [__($status)]]);
+ }
+}
diff --git a/app/Http/Controllers/PasswordResetLinkController.php b/app/Http/Controllers/PasswordResetLinkController.php
new file mode 100644
index 0000000..cca2052
--- /dev/null
+++ b/app/Http/Controllers/PasswordResetLinkController.php
@@ -0,0 +1,31 @@
+validate([
+ 'email' => 'required|email',
+ ]);
+
+ $status = Password::sendResetLink(
+ $request->only('email')
+ );
+
+ if ($status == Password::RESET_LINK_SENT) {
+ return back()->with('status', __($status));
+ }
+
+ return back()->withErrors(['email' => __($status)]);
+ }
+}
diff --git a/app/Models/User.php b/app/Models/User.php
index 5c0bb00..d806001 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -6,6 +6,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
+use App\Notifications\ResetPasswordNotification;
class User extends Authenticatable
{
@@ -45,4 +46,15 @@ class User extends Authenticatable
'password' => 'hashed',
];
}
+
+ /**
+ * Send the password reset notification.
+ *
+ * @param string $token
+ * @return void
+ */
+ public function sendPasswordResetNotification($token)
+ {
+ $this->notify(new ResetPasswordNotification($token));
+ }
}
diff --git a/app/Notifications/ResetPasswordNotification.php b/app/Notifications/ResetPasswordNotification.php
new file mode 100644
index 0000000..d2bcfeb
--- /dev/null
+++ b/app/Notifications/ResetPasswordNotification.php
@@ -0,0 +1,26 @@
+ $this->token,
+ 'email' => $notifiable->getEmailForPasswordReset(),
+ ], false));
+
+ return (new MailMessage)
+ ->subject('Recuperación de Contraseña - Lauck')
+ ->view('emails.reset-password', [
+ 'url' => $url,
+ ]);
+ }
+}
diff --git a/resources/views/auth/forgot-password.blade.php b/resources/views/auth/forgot-password.blade.php
new file mode 100644
index 0000000..3c6e665
--- /dev/null
+++ b/resources/views/auth/forgot-password.blade.php
@@ -0,0 +1,51 @@
+
|
+
+ + © {{ date('Y') }} Bicicletería Lauck. Todos los derechos reservados. + + |
+