#124: Updated the change e-mail confirmation to be a notification
This commit is contained in:
parent
4af68cd055
commit
e794f99ead
@ -2,20 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Gallery;
|
namespace App\Http\Controllers\Gallery;
|
||||||
|
|
||||||
use App\Album;
|
|
||||||
use App\Facade\Theme;
|
use App\Facade\Theme;
|
||||||
use App\Facade\UserConfig;
|
use App\Facade\UserConfig;
|
||||||
use App\Helpers\DbHelper;
|
use App\Helpers\DbHelper;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\SaveUserSettingsRequest;
|
use App\Http\Requests\SaveUserSettingsRequest;
|
||||||
use App\Mail\UserChangeEmailRequired;
|
use App\Notifications\UserChangeEmailRequired;
|
||||||
use App\User;
|
use App\User;
|
||||||
use App\UserActivity;
|
use App\UserActivity;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Mail;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
@ -528,7 +525,7 @@ class UserController extends Controller
|
|||||||
$oldEmailAddress = $user->email;
|
$oldEmailAddress = $user->email;
|
||||||
$user->email = $newEmailAddress;
|
$user->email = $newEmailAddress;
|
||||||
|
|
||||||
Mail::to($user)->send(new UserChangeEmailRequired($user));
|
$user->notify(new UserChangeEmailRequired());
|
||||||
$user->email = $oldEmailAddress;
|
$user->email = $oldEmailAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,11 +6,9 @@ use App\Facade\Theme;
|
|||||||
use App\Facade\UserConfig;
|
use App\Facade\UserConfig;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Mail\Mailable;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
|
|
||||||
class UserChangeEmailRequired extends Mailable
|
class UserChangeEmailRequired extends MailableBase
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
39
app/Notifications/UserChangeEmailRequired.php
Normal file
39
app/Notifications/UserChangeEmailRequired.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use App\Mail\MailableBase;
|
||||||
|
use App\Mail\UserChangeEmailRequired as UserChangeEmailRequiredMailable;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class UserChangeEmailRequired extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
use DatabaseEmailNotification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage|MailableBase
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
$mailable = new UserChangeEmailRequiredMailable($notifiable);
|
||||||
|
|
||||||
|
$this->setPropertiesOnMailable($mailable, $notifiable);
|
||||||
|
|
||||||
|
return $mailable;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user