mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 05:32:39 +01:00
cf1e65f1c0
* Refactor pivot table accessors * Add select2 for client - country selector * Fixes for client contact update * implement ctrans() function across application * Increase custom fields to 4 across the application * Refactor: remove repos calling other repos, implement 4 custom values across application * include querying the custom values in the client list * Fix null custom value labels * Scaffold for client - show view * Working on Client Show
34 lines
835 B
PHP
34 lines
835 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Traits;
|
|
|
|
use App\Models\User;
|
|
use App\Utils\Traits\UserSessionAttributes;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
trait VerifiesUserEmail
|
|
{
|
|
use UserSessionAttributes;
|
|
|
|
public function confirm($code)
|
|
{
|
|
$user = User::where('confirmation_code', $code)->first();
|
|
|
|
if ($user) {
|
|
|
|
$user->email_verified_at = now();
|
|
$user->confirmation_code = null;
|
|
$user->save();
|
|
|
|
$this->setCurrentCompanyId($user->companies()->first()->account->default_company_id);
|
|
|
|
Auth::loginUsingId($user->id, true);
|
|
|
|
return redirect()->route('dashboard.index')->with('message', ctrans('texts.security_confirmation'));
|
|
|
|
}
|
|
|
|
return redirect()->route('login')->with('message', ctrans('texts.wrong_confirmation'));
|
|
|
|
}
|
|
} |