-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a3c95b
commit bd39d14
Showing
10 changed files
with
277 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Mail; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class ForgetPasswordMail extends Mailable | ||
{ | ||
public $user_name; | ||
public $reset_code; | ||
|
||
use Queueable, SerializesModels; | ||
|
||
/** | ||
* Create a new message instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct($user_name, $reset_code) | ||
{ | ||
$this->user_name = $user_name; | ||
$this->reset_code = $reset_code; | ||
} | ||
|
||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
return $this->markdown('emails.forget_pasword_mail')->with([ | ||
'user_name' => $this->user_name, | ||
'reset_code' => $this->reset_code | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class ResetPassword extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $fillable = [ | ||
'user_id', | ||
'reset_code' | ||
]; | ||
} |
33 changes: 33 additions & 0 deletions
33
database/migrations/2021_08_09_140725_create_reset_passwords_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateResetPasswordsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('reset_passwords', function (Blueprint $table) { | ||
$table->id(); | ||
$table->unsignedBigInteger('user_id'); | ||
$table->string('reset_code'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('reset_passwords'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
@tailwind base; | ||
|
||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
@tailwind utilities; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
<div class="flex justify-center"> | ||
<div class="w-4/12 bg-white p-6 rounded-lg"> | ||
@if (session('error')) | ||
<div class="bg-red-500 p-4 rounded-lg mb-6 text-white text-center"> | ||
{{ session('error') }} | ||
</div> | ||
@endif | ||
@if (session('success')) | ||
<div class="bg-red-500 p-4 rounded-lg mb-6 text-white text-center"> | ||
{{ session('success') }} | ||
</div> | ||
@endif | ||
@if (session('message')) | ||
<div class="bg-red-500 p-4 rounded-lg mb-6 text-white text-center"> | ||
{{ session('message') }} | ||
</div> | ||
@endif | ||
<form action="{{route('postForgetPassword')}}" method="POST"> | ||
@csrf | ||
|
||
<div class="mb-4"> | ||
<label for="email" class="sr-only">Email</label> | ||
<input type="text" name="email" id="email" placeholder="Your email" class="bg-gray-100 border-2 w-full p-4 rounded-lg @error('email') border-red-500 @enderror" value="{{ old('email') }}"> | ||
|
||
@error('email') | ||
<div class="text-red-500 mt-2 text-sm"> | ||
{{ $message }} | ||
</div> | ||
@enderror | ||
</div> | ||
|
||
<div> | ||
<button type="submit" class="bg-blue-500 text-white px-4 py-3 rounded font-medium w-full">Forget Password</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@component('mail::message') | ||
|
||
Hello {{$user_name}} | ||
|
||
Click here to reset your password | ||
|
||
@component('mail::button', ['url' => route('getResetPassword',$reset_code)]) | ||
Reset Password | ||
@endcomponent | ||
<p>Or copy & paste the following link to your browser</p> | ||
<p><a href="{{route('getResetPassword',$reset_code)}}">{{route('getResetPassword',$reset_code)}}</a></p> | ||
|
||
Thanks,<br> | ||
{{ config('app.name') }} | ||
@endcomponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
<div class="flex justify-center"> | ||
<div class="w-4/12 bg-white p-6 rounded-lg"> | ||
<form action="{{ route('postResetPassword',$reset_code) }}" method="post"> | ||
@csrf | ||
|
||
<div class="mb-4"> | ||
<label for="email" class="sr-only">Email</label> | ||
<input type="text" name="email" id="email" placeholder="Your email" class="bg-gray-100 border-2 w-full p-4 rounded-lg @error('email') border-red-500 @enderror" value="{{ old('email') }}"> | ||
|
||
@error('email') | ||
<div class="text-red-500 mt-2 text-sm"> | ||
{{ $message }} | ||
</div> | ||
@enderror | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<label for="password" class="sr-only">Password</label> | ||
<input type="password" name="password" id="password" placeholder="Choose a password" class="bg-gray-100 border-2 w-full p-4 rounded-lg @error('password') border-red-500 @enderror" value=""> | ||
|
||
@error('password') | ||
<div class="text-red-500 mt-2 text-sm"> | ||
{{ $message }} | ||
</div> | ||
@enderror | ||
</div> | ||
|
||
<div class="mb-4"> | ||
<label for="password_confirmation" class="sr-only">Confirm Password</label> | ||
<input type="password" name="password_confirmation" id="password_confirmation" placeholder="Repeat your password" class="bg-gray-100 border-2 w-full p-4 rounded-lg @error('password_confirmation') border-red-500 @enderror" value=""> | ||
|
||
@error('password_confirmation') | ||
<div class="text-red-500 mt-2 text-sm"> | ||
{{ $message }} | ||
</div> | ||
@enderror | ||
</div> | ||
<div> | ||
<button type="submit" class="bg-blue-500 text-white px-4 py-3 rounded font-medium w-full">Submit</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters