2021-06-26 11:23:15 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Auth\Access;
|
2019-08-17 10:52:33 -04:00
|
|
|
|
|
|
|
use BookStack\Auth\User;
|
|
|
|
use BookStack\Notifications\UserInvite;
|
|
|
|
|
|
|
|
class UserInviteService extends UserTokenService
|
|
|
|
{
|
2023-04-04 05:44:38 -04:00
|
|
|
protected string $tokenTable = 'user_invites';
|
|
|
|
protected int $expiryTime = 336; // Two weeks
|
2019-08-17 10:52:33 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send an invitation to a user to sign into BookStack
|
|
|
|
* Removes existing invitation tokens.
|
|
|
|
*/
|
|
|
|
public function sendInvitation(User $user)
|
|
|
|
{
|
|
|
|
$this->deleteByUser($user);
|
|
|
|
$token = $this->createTokenForUser($user);
|
|
|
|
$user->notify(new UserInvite($token));
|
|
|
|
}
|
|
|
|
}
|