Password Reset work

This commit is contained in:
Deon George 2020-01-22 21:05:31 +11:00
parent b42f9990b5
commit 436c3d6787
10 changed files with 72 additions and 62 deletions

View File

@ -32,13 +32,13 @@ before_script:
# Add gnupg & zip
- apt-get update -yqq && apt-get install gnupg2 unzip -yqq
# Upgrade to Node 9
- curl -sL https://deb.nodesource.com/setup_9.x | bash -
# Upgrade to Node 12
- curl -sL https://deb.nodesource.com/setup_12.x | bash -
# Install dependencies
#- apt-get install git nodejs libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev pkg-config libsnmp-dev snmp-mibs-downloader -yqq
#- download-mibs
- apt-get install git nodejs -yqq
- apt-get install git autoconf nodejs -yqq
# Install php extensions
#- docker-php-ext-configure gd --with-freetype-dir=/usr/include/freetype2 --with-jpeg-dir=/usr/include/

View File

@ -20,16 +20,6 @@ class ForgotPasswordController extends Controller
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
public function showLinkRequestForm()
{
return view('adminlte::auth.passwords.email');

View File

@ -2,10 +2,12 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
class ResetPasswordController extends Controller
{
/*
@ -26,26 +28,8 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
protected function rules()
{
return [
'token' => 'required',
'email' => 'required|email|exists:users',
'password' => 'required|confirmed|min:6',
];
}
public function showResetForm(Request $request, $token = null)
{
return view('adminlte::auth.passwords.reset')->with(

View File

@ -11,23 +11,36 @@ class ResetPasswordNotification extends Notification
{
use Queueable;
public $token;
/**
* The password reset token.
*
* @var string
*/
public $token;
/**
* Create a new notification instance.
* The callback that should be used to build the mail message.
*
* @var \Closure|null
*/
public static $toMailCallback;
/**
* Create a notification instance.
*
* @param string $token
* @return void
*/
public function __construct($token)
{
$this->token = $token;
$this->token = $token;
}
/**
* Get the notification's delivery channels.
* Get the notification's channels.
*
* @param mixed $notifiable
* @return array
* @return array|string
*/
public function via($notifiable)
{
@ -35,18 +48,33 @@ class ResetPasswordNotification extends Notification
}
/**
* Get the mail representation of the notification.
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$logo = config('SITE_SETUP')->site_logo;
$site_name = config('SITE_SETUP')->site_name;
$reset_link = route('password.reset', $this->token, true);
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
}
return (new MailMessage)
->markdown('email.user.passwordreset',compact('logo','site_name','reset_link'));
return (new MailMessage)
->markdown('email.user.passwordreset',[
'site'=>config('SITE_SETUP'),
'user'=>$notifiable,
'reset_link'=>route('password.reset',$this->token,true),
]);
}
/**
* Set a callback that should be used when building the notification mail message.
*
* @param \Closure $callback
* @return void
*/
public static function toMailUsing($callback)
{
static::$toMailCallback = $callback;
}
}

6
composer.lock generated
View File

@ -2336,11 +2336,11 @@
},
{
"name": "leenooks/laravel",
"version": "6.0.13",
"version": "6.0.14",
"source": {
"type": "git",
"url": "https://dev.leenooks.net/leenooks/laravel",
"reference": "62f66d7eedaa4e86595965e146fb1cf3e9c341d8"
"reference": "176f680ff740d41b6e66723557e2e64721e0d51f"
},
"require": {
"creativeorange/gravatar": "^1.0",
@ -2377,7 +2377,7 @@
"laravel",
"leenooks"
],
"time": "2020-01-14T10:43:40+00:00"
"time": "2020-01-22T09:48:42+00:00"
},
{
"name": "monolog/monolog",

View File

@ -1,19 +1,19 @@
@component('mail::message',['site_name'=>$site_name,'logo'=>$logo])
# Password Reset
@component('mail::message',['site'=>$site,'heading'=>'Password Reset'])
Hi {{ isset($user) ? $user->name.',' : '' }}
You are receiving this email because we received a password reset request for your account.
If you did not request a password reset, no further action is required.
To reset your password, please follow this link, or click on the URL below:
@component('mail::button', ['url' => $reset_link])
@component('mail::panel',['url'=>$reset_link])
Reset Password
@endcomponent
@component('mail::panel')
@component('mail::subcopy')
Reset password: {{ $reset_link }}
@endcomponent
Thanks,<br>
{{ $site_name }}
{{ config('mail.from.name') }}
@endcomponent

View File

@ -1,6 +1,6 @@
<div class="header">
<div class="fixedw">
<img src="{{ $logo }}"><br>
<img src="{{ url($site->email_logo) }}"><br>
<div class="subject">{{ $slot }}</div>
</div>
</div>

View File

@ -1,7 +1,7 @@
@component('mail::layout')
{{-- Header --}}
@slot('header')
@component('mail::header', ['url' => config('app.url'),'logo'=>url($site->email_logo)])
@component('mail::header',['site'=>$site])
{{ $heading }}
@endcomponent
@endslot

View File

@ -1,5 +1,9 @@
<div style="margin: auto; text-align: center; padding-bottom: 20px;">
<div class="panel">
{{ $slot }}
@isset($url)
<a href="{{ $url }}">{{ $slot }}</a>
@else
{{ $slot }}
@endisset
</div>
</div>

View File

@ -41,8 +41,9 @@ body{
border-radius: 10px;
padding: 10px;
font-weight: 300;
margin-top: 20px;
margin-top: 10px;
font-size: 0.8em;
margin-bottom: 10px;
}
.main-body{
background: #ffffff;
@ -74,13 +75,16 @@ body{
font-weight: 300;
font-style: normal;
}
/* -- TO VALIDATE -- */
a{
.panel a{
text-decoration: underline;
color: #1cbbb4
color: #f4f4f4;
}
.panel a:hover{
text-decoration: none;
color: #ffffff;
}
a:hover{text-decoration: none;}
/* -- TO VALIDATE -- */
h1{
font-weight: 300;
color: #121212;