HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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);
    }
}