mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:44:35 -04:00
Verify user notification (#3474)
This commit is contained in:
parent
70a560c474
commit
b2033a54f4
@ -27,11 +27,10 @@ trait VerifiesUserEmail
|
|||||||
* @param $code
|
* @param $code
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function confirm($code)
|
public function confirm()
|
||||||
{
|
{
|
||||||
//$user = User::where('confirmation_code', $code)->first();
|
|
||||||
|
if ($user = User::whereRaw("BINARY `confirmation_code`= ?", request()->route('confirmation_code'))->first()) {
|
||||||
if ($user = User::whereRaw("BINARY `confirmation_code`= ?", $code)->first()) {
|
|
||||||
$user->email_verified_at = now();
|
$user->email_verified_at = now();
|
||||||
$user->confirmation_code = null;
|
$user->confirmation_code = null;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
@ -75,7 +75,7 @@ class CreateUser
|
|||||||
//'settings' => DefaultSettings::userSettings(),
|
//'settings' => DefaultSettings::userSettings(),
|
||||||
'settings' => null,
|
'settings' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
event(new UserWasCreated($user, $this->company));
|
event(new UserWasCreated($user, $this->company));
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Mail\VerifyUser;
|
use App\Notifications\Ninja\VerifyUser;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
@ -42,14 +42,11 @@ class SendVerificationNotification implements ShouldQueue
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle($event)
|
public function handle($event)
|
||||||
{//todo handle the change of DB locaiton to Company Token table
|
{
|
||||||
/*send confirmation email using $event->user*/
|
|
||||||
|
|
||||||
MultiDB::setDB($event->company->db);
|
MultiDB::setDB($event->company->db);
|
||||||
|
|
||||||
Mail::to($event->user->email)
|
$event->user->notify(new VerifyUser($event->user));
|
||||||
//->cc('')
|
|
||||||
//->bcc('')
|
|
||||||
->queue(new VerifyUser($event->user));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
86
app/Notifications/Ninja/VerifyUser.php
Normal file
86
app/Notifications/Ninja/VerifyUser.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications\Ninja;
|
||||||
|
|
||||||
|
use App\Mail\Signup\NewSignup;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class VerifyUser extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
public function __construct($user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'title' => ctrans('texts.confirmation_subject'),
|
||||||
|
'message' => ctrans('texts.confirmation_message'),
|
||||||
|
'url' => url("/user/confirm/{$this->user->confirmation_code}"),
|
||||||
|
'button' => ctrans('texts.button_confirmation_message'),
|
||||||
|
'signature' => '',
|
||||||
|
'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png',
|
||||||
|
];
|
||||||
|
|
||||||
|
return (new MailMessage)
|
||||||
|
->subject(ctrans('texts.confirmation_subject'))
|
||||||
|
->markdown('email.admin.generic', $data);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toSlack($notifiable)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,6 @@ Route::group(['middleware' => ['invite_db'], 'prefix' => '', 'as' => ''], functi
|
|||||||
/*Invitation catches*/
|
/*Invitation catches*/
|
||||||
|
|
||||||
Route::get('{entity}/{invitation_key}/download', 'ClientPortal\InvitationController@routerForDownload');
|
Route::get('{entity}/{invitation_key}/download', 'ClientPortal\InvitationController@routerForDownload');
|
||||||
|
|
||||||
Route::get('invoice/{invitation_key}/download_pdf', 'InvoiceController@downloadPdf')->name('invoice.download_pdf');
|
Route::get('invoice/{invitation_key}/download_pdf', 'InvoiceController@downloadPdf')->name('invoice.download_pdf');
|
||||||
Route::get('quote/{invitation_key}/download_pdf', 'QuoteController@downloadPdf')->name('quote.download_pdf');
|
Route::get('quote/{invitation_key}/download_pdf', 'QuoteController@downloadPdf')->name('quote.download_pdf');
|
||||||
Route::get('credit/{invitation_key}/download_pdf', 'CreditController@downloadPdf')->name('credit.download_pdf');
|
Route::get('credit/{invitation_key}/download_pdf', 'CreditController@downloadPdf')->name('credit.download_pdf');
|
||||||
@ -34,10 +33,10 @@ Route::group(['middleware' => ['invite_db'], 'prefix' => '', 'as' => ''], functi
|
|||||||
* Password Reset Routes...
|
* Password Reset Routes...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
|
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
|
||||||
// Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
|
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
|
||||||
// Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
|
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
|
||||||
// Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
|
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Social authentication
|
* Social authentication
|
||||||
@ -100,11 +99,11 @@ Route::group(['middleware' => ['auth:user', 'web_db']], function () {
|
|||||||
/*
|
/*
|
||||||
* Inbound routes requiring DB Lookup
|
* Inbound routes requiring DB Lookup
|
||||||
*/
|
*/
|
||||||
// Route::group(['middleware' => ['url_db']], function () {
|
Route::group(['middleware' => ['url_db']], function () {
|
||||||
|
|
||||||
// Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm');
|
Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm');
|
||||||
|
|
||||||
// });
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user