mirror of
https://gitlab.com/omair-personal/izyim.git
synced 2026-08-19 04:14:05 +00:00
Merge branch 'changePassword' into 'master'
Change password and forgot password See merge request CIEFWorldwideSdnBhd/izyim!14
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Accounts;
|
||||
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserInvitationObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUserInvitation;
|
||||
use App\Classes\Modules\Accounts\Validation\CanSendAccountInvitation;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\ResourceConflictException;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Events\Accounts\UserInvited;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ForgotAccountLogic
|
||||
{
|
||||
|
||||
/** @var CreatesUserInvitation */
|
||||
private $createUserInvitation;
|
||||
|
||||
/** @var CanSendAccountInvitation */
|
||||
private $canSendAccountInvitation;
|
||||
|
||||
/**
|
||||
* CreateAccountInvitationLogic constructor.
|
||||
* @param CreatesUserInvitation $createUserInvitation
|
||||
* @param CanSendAccountInvitation $canSendAccountInvitation
|
||||
*/
|
||||
public function __construct(CreatesUserInvitation $createUserInvitation, CanSendAccountInvitation $canSendAccountInvitation)
|
||||
{
|
||||
$this->createUserInvitation = $createUserInvitation;
|
||||
$this->canSendAccountInvitation = $canSendAccountInvitation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute(Request $request) {
|
||||
|
||||
try {
|
||||
|
||||
$object = new UserInvitationObject($request->get('role_id'), $request->get('email'));
|
||||
|
||||
if($this->canSendAccountInvitation->execute($object)){
|
||||
|
||||
|
||||
$invitation = $this->createUserInvitation->execute($object);
|
||||
|
||||
event(new UserInvited($invitation));
|
||||
|
||||
return new JsonResponse("Invitation have been sent!", HttpStatus::RESOURCE_CREATED);
|
||||
}
|
||||
|
||||
} catch (ResourceConflictException $exception) {
|
||||
throw new InternalServerErrorException("Failed to send user invitation because {$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
//namespace App\Http\Controllers\Account;
|
||||
//
|
||||
//use App\Classes\Modules\ControllersLogic\Accounts\ForgotAccountLogic;
|
||||
//use App\Http\Controllers\Controller;
|
||||
//use Illuminate\Http\JsonResponse;
|
||||
//use Illuminate\Http\RedirectResponse;
|
||||
//use Illuminate\Http\Request;
|
||||
//
|
||||
//class ForgotAccountController extends Controller
|
||||
//{
|
||||
// /**
|
||||
// * @param Request $request
|
||||
// * @param ForgotAccountLogic $logic
|
||||
// * @return JsonResponse
|
||||
// * @throws \App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException
|
||||
// * @throws \App\Classes\Modules\ControllerLogic\Exceptions\MalformedRequestException
|
||||
// */
|
||||
// public function forgot(Request $request, ForgotAccountLogic $logic): JsonResponse
|
||||
// {
|
||||
// return $logic->execute($request);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Account;
|
||||
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ForgotAccountController extends Controller
|
||||
{
|
||||
/**
|
||||
* Send an e-mail reminder to the user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function forgot()
|
||||
{
|
||||
|
||||
Mail::send('emails.reminder', ['user' => "ahmad"], function ($m) {
|
||||
$m->from('2f114cfc66-6c1272@inbox.mailtrap.io', 'Your Application');
|
||||
|
||||
$m->to("2f114cfc66-6c1272@inbox.mailtrap.io", "ahmad")->subject('Your Reminder!');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
<div class="row m-t-5">
|
||||
<div class="col no-padding">
|
||||
<small class="text-complete">Forgot your password?</small>
|
||||
<a href="{{ route("password.forgot") }}"><small class="text-complete">Forgot your password?</small></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
@extends('layouts.base')
|
||||
|
||||
@section('content')
|
||||
<div class="fluid-container h-100">
|
||||
<div class="row no-margin" style=" min-height: 100%; ">
|
||||
<div class="col no-padding" style="background-image: url({{asset('images/shipping_bg.jpeg')}}); background-position: center; background-size: cover;">
|
||||
<div class="w-100 h-100 bg-primary" style="position: absolute; opacity: 0.1;"></div>
|
||||
</div>
|
||||
<div class="col-4 padding-50 bg-white">
|
||||
<div class="row m-t-50">
|
||||
<div class="col m-t-50 p-l-0">
|
||||
<img src="{{asset('images/logo.png')}}" alt="logo" height="35">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-50">
|
||||
<div class="col">
|
||||
<div class="inline v-align-middle">
|
||||
<h4 class="font-heading no-margin lh-28">Change Your Password</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@if($errors->any())
|
||||
@foreach ($errors->all() as $error)
|
||||
<div class="error">{{ $error }}</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" id="form-login" class="p-t-15" action="{{ route('password.update') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="token" value="{{ $token }}">
|
||||
<div class="form-group form-group-default">
|
||||
<label>Email</label>
|
||||
<div class="controls">
|
||||
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ $email ?? old('email') }}" placeholder="Your Email" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-default">
|
||||
<label>Password</label>
|
||||
<div class="controls">
|
||||
<input type="password" class="form-control" name="password" placeholder="Credentials" required>
|
||||
@if ($errors->has('password'))
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $errors->first('password') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-default">
|
||||
<label>Confirm Password</label>
|
||||
<div class="controls">
|
||||
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" placeholder="Credentials" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-end align-items-end">
|
||||
<div class="col-auto">
|
||||
<button type="submit" class="btn btn-primary btn-cons m-t-10 pull-right m-r-0">Change</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{--<form method="POST" action="{{ route('password.update') }}">--}}
|
||||
{{--@csrf--}}
|
||||
|
||||
{{--<input type="hidden" name="token" value="{{ $token }}">--}}
|
||||
|
||||
{{--<div class="form-group row">--}}
|
||||
{{--<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>--}}
|
||||
|
||||
{{--<div class="col-md-6">--}}
|
||||
{{--<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ $email ?? old('email') }}" required autofocus>--}}
|
||||
|
||||
{{--@if ($errors->has('email'))--}}
|
||||
{{--<span class="invalid-feedback" role="alert">--}}
|
||||
{{--<strong>{{ $errors->first('email') }}</strong>--}}
|
||||
{{--</span>--}}
|
||||
{{--@endif--}}
|
||||
{{--</div>--}}
|
||||
{{--</div>--}}
|
||||
|
||||
{{--<div class="form-group row">--}}
|
||||
{{--<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>--}}
|
||||
|
||||
{{--<div class="col-md-6">--}}
|
||||
{{--<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>--}}
|
||||
|
||||
{{--@if ($errors->has('password'))--}}
|
||||
{{--<span class="invalid-feedback" role="alert">--}}
|
||||
{{--<strong>{{ $errors->first('password') }}</strong>--}}
|
||||
{{--</span>--}}
|
||||
{{--@endif--}}
|
||||
{{--</div>--}}
|
||||
{{--</div>--}}
|
||||
|
||||
{{--<div class="form-group row">--}}
|
||||
{{--<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>--}}
|
||||
|
||||
{{--<div class="col-md-6">--}}
|
||||
{{--<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>--}}
|
||||
{{--</div>--}}
|
||||
{{--</div>--}}
|
||||
|
||||
{{--<div class="form-group row mb-0">--}}
|
||||
{{--<div class="col-md-6 offset-md-4">--}}
|
||||
{{--<button type="submit" class="btn btn-primary">--}}
|
||||
{{--{{ __('Reset Password') }}--}}
|
||||
{{--</button>--}}
|
||||
{{--</div>--}}
|
||||
{{--</div>--}}
|
||||
{{--</form>--}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,92 @@
|
||||
@extends('layouts.base')
|
||||
|
||||
@section('content')
|
||||
@if (session('status'))
|
||||
<div class="fluid-container h-100">
|
||||
<div class="row no-margin" style="min-height: 100%; ">
|
||||
<div class="card no-margin" style="background-image: url({{asset('images/shipping_bg.jpeg')}}); background-position: center; background-size: cover;">
|
||||
<div class="card-body row align-items-center justify-content-center">
|
||||
<div class="col-5 padding-50 bg-white text-center">
|
||||
<div class="password_panel">
|
||||
<div class="password_desc">
|
||||
<i class="text-success fs-40 block"></i>
|
||||
<h5 class="font-heading bold">We just sent an email to reset your password</h5>
|
||||
<p class="text-muted no-margin p-b-20">Click on the link we've sent you to reset your password.
|
||||
if you have not received an email, Please check your spambox</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col no-padding text-center">
|
||||
<a href="{{ route('login') }}">
|
||||
<button class="btn btn-primary">Back to Login</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="fluid-container h-100">
|
||||
<div class="row no-margin" style=" min-height: 100%; ">
|
||||
<div class="col no-padding" style="background-image: url({{asset('images/shipping_bg.jpeg')}}); background-position: center; background-size: cover;">
|
||||
<div class="w-100 h-100 bg-primary" style="position: absolute; opacity: 0.1;"></div>
|
||||
</div>
|
||||
<div class="col-4 padding-50 bg-white">
|
||||
<div class="row m-t-50">
|
||||
<div class="col m-t-50 p-l-0">
|
||||
<img src="{{asset('images/logo.png')}}" alt="logo" height="35">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-50">
|
||||
<div class="col">
|
||||
<div class="inline v-align-middle">
|
||||
<h4 class="font-heading no-margin lh-28">Forget Your Password</h4>
|
||||
<p class="no-margin hint-text lh-18">Reset it using your credentials</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@if($errors->any())
|
||||
@foreach ($errors->all() as $error)
|
||||
<div class="error">{{ $error }}</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<form method="POST" action="{{ route('password.email') }}">
|
||||
@csrf
|
||||
|
||||
<div class="form-group form-group-default">
|
||||
<label>Username</label>
|
||||
<div class="controls">
|
||||
<input name="email" placeholder="Email Address" id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
@if ($errors->has('email'))
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $errors->first('email') }}</strong>
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-end align-items-end">
|
||||
<div class="col-auto">
|
||||
{{ csrf_field() }}
|
||||
<button class="btn btn-primary btn-cons m-t-10 pull-right m-r-0">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
@@ -9,6 +9,15 @@ Route::group(['prefix' => 'auth'], function () {
|
||||
|
||||
Route::post('/registration/create', 'Account\RegisterAccountController@register')->name('auth.registration.create');
|
||||
|
||||
Route::get('password/forgot', function () {
|
||||
return view('pages.authentication.password.forgot');
|
||||
})->name('password.forgot');
|
||||
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
|
||||
Route::get('password/reset/{token}', function ($token){
|
||||
return view('pages.authentication.password.change',['token' => $token]);
|
||||
})->name('password.reset');
|
||||
Route::post('password/update', 'Auth\ResetPasswordController@reset')->name('password.update');
|
||||
|
||||
Route::get('/logout', 'Auth\LoginController@logout')->name('auth.logout');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user