-<?php namespace Oxbow\Services;
+<?php namespace BookStack\Services;
use Carbon\Carbon;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Mail\Message;
-use Oxbow\EmailConfirmation;
-use Oxbow\Exceptions\ConfirmationEmailException;
-use Oxbow\Exceptions\UserRegistrationException;
-use Oxbow\Repos\UserRepo;
-use Oxbow\Setting;
-use Oxbow\User;
+use BookStack\EmailConfirmation;
+use BookStack\Exceptions\ConfirmationEmailException;
+use BookStack\Exceptions\UserRegistrationException;
+use BookStack\Repos\UserRepo;
+use BookStack\Setting;
+use BookStack\User;
class EmailConfirmationService
{
*/
public function sendConfirmation(User $user)
{
- if($user->email_confirmed) {
+ if ($user->email_confirmed) {
throw new ConfirmationEmailException('Email has already been confirmed, Try logging in.', '/login');
}
$this->deleteConfirmationsByUser($user);
'token' => $token,
]);
$this->mailer->send('emails/email-confirmation', ['token' => $token], function (Message $message) use ($user) {
- $appName = \Setting::get('app-name', 'BookStack');
+ $appName = setting('app-name', 'BookStack');
$message->to($user->email, $user->name)->subject('Confirm your email on ' . $appName . '.');
});
}
}
// If more than a day old
- if(Carbon::now()->subDay()->gt($emailConfirmation->created_at)) {
+ if (Carbon::now()->subDay()->gt($emailConfirmation->created_at)) {
$this->sendConfirmation($emailConfirmation->user);
throw new UserRegistrationException('The confirmation token has expired, A new confirmation email has been sent.', '/register/confirm');
}