1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 03:12:32 +01:00
BookStack/app/Access/UserInviteService.php

24 lines
607 B
PHP
Raw Normal View History

2021-06-26 17:23:15 +02:00
<?php
2023-05-17 18:56:55 +02:00
namespace BookStack\Access;
2019-08-17 16:52:33 +02:00
use BookStack\Access\Notifications\UserInviteNotification;
2023-05-17 18:56:55 +02:00
use BookStack\Users\Models\User;
2019-08-17 16:52:33 +02:00
class UserInviteService extends UserTokenService
{
2023-04-04 11:44:38 +02:00
protected string $tokenTable = 'user_invites';
protected int $expiryTime = 336; // Two weeks
2019-08-17 16:52:33 +02: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 UserInviteNotification($token));
2019-08-17 16:52:33 +02:00
}
}