File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Auth/AuthMailService.php
<?php
namespace App\Auth;
use App\Notifications\SiteUserResetPasswordNotification;
use App\Notifications\SiteUserSetPasswordNotification;
use App\Users\SiteUserInterface;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Facades\Password;
use Komma\KMS\Auth\AuthMailService as KmsAuthMailService;
/**
* Class AuthMailService
*
* A service responsible for sending mails about authorisation and authentication.
*
* @package App\Auth
*/
class AuthMailService extends KmsAuthMailService
{
/**
* Notify user that he needs to set a password to login
*
* @param Authenticatable $newUser
* @return null
*/
public function notifyUserToSetPassword(Authenticatable $newUser)
{
$token = Password::getRepository()->create($newUser);
if(is_a($newUser, SiteUserInterface::class)) {
$newUser->notify(new SiteUserSetPasswordNotification($newUser, $token));
return null;
}
return parent::notifyUserToSetPassword($newUser);
}
/**
* Notify user that he needs to set a password to login
*
* @param Authenticatable $newUser
* @return null
*/
public function notifyUserToResetPassword(Authenticatable $newUser)
{
$token = Password::getRepository()->create($newUser);
if(is_a($newUser, SiteUserInterface::class)) {
$newUser->notify(new SiteUserResetPasswordNotification($newUser, $token));
return null;
}
return parent::notifyUserToResetPassword($newUser);
}
}