]> BookStack Code Mirror - bookstack/blobdiff - app/Services/EmailConfirmationService.php
replace GPL diff lib with MIT lib
[bookstack] / app / Services / EmailConfirmationService.php
index dd85ad83444fc9614958f6daa493bc468c29fd84..c3096c654fb0fb0e1853d6ec5961b8f9df78d07a 100644 (file)
@@ -1,15 +1,15 @@
-<?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
 {
@@ -35,7 +35,7 @@ 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);
@@ -45,7 +45,7 @@ class EmailConfirmationService
             '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 . '.');
         });
     }
@@ -66,7 +66,7 @@ class EmailConfirmationService
         }
 
         // 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');
         }