Browse Source

#124: Updated the change e-mail confirmation to be a notification

tags/v2.2.0-beta.1
Andy Heathershaw 7 months ago
parent
commit
e794f99ead
3 changed files with 42 additions and 8 deletions
  1. +2
    -5
      app/Http/Controllers/Gallery/UserController.php
  2. +1
    -3
      app/Mail/UserChangeEmailRequired.php
  3. +39
    -0
      app/Notifications/UserChangeEmailRequired.php

+ 2
- 5
app/Http/Controllers/Gallery/UserController.php View File

@@ -2,20 +2,17 @@

namespace App\Http\Controllers\Gallery;

use App\Album;
use App\Facade\Theme;
use App\Facade\UserConfig;
use App\Helpers\DbHelper;
use App\Http\Controllers\Controller;
use App\Http\Requests\SaveUserSettingsRequest;
use App\Mail\UserChangeEmailRequired;
use App\Notifications\UserChangeEmailRequired;
use App\User;
use App\UserActivity;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use Symfony\Component\HttpFoundation\Request;

class UserController extends Controller
@@ -528,7 +525,7 @@ class UserController extends Controller
$oldEmailAddress = $user->email;
$user->email = $newEmailAddress;

Mail::to($user)->send(new UserChangeEmailRequired($user));
$user->notify(new UserChangeEmailRequired());
$user->email = $oldEmailAddress;
}
}

+ 1
- 3
app/Mail/UserChangeEmailRequired.php View File

@@ -6,11 +6,9 @@ use App\Facade\Theme;
use App\Facade\UserConfig;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class UserChangeEmailRequired extends Mailable
class UserChangeEmailRequired extends MailableBase
{
use Queueable, SerializesModels;



+ 39
- 0
app/Notifications/UserChangeEmailRequired.php View 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…
Cancel
Save