1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Mail/Admin/VerifyUserObject.php

65 lines
1.9 KiB
PHP
Raw Normal View History

2021-02-14 12:09:32 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2022-04-27 05:20:41 +02:00
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
2021-02-14 12:09:32 +01:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2021-02-14 12:09:32 +01:00
*/
namespace App\Mail\Admin;
2021-06-29 11:46:40 +02:00
use App\Utils\Ninja;
2021-02-14 12:09:32 +01:00
use App\Utils\Traits\MakesHash;
2021-06-29 11:46:40 +02:00
use Illuminate\Support\Facades\App;
2021-02-14 12:09:32 +01:00
class VerifyUserObject
{
use MakesHash;
public $user;
public $company;
public function __construct($user, $company)
{
$this->user = $user;
$this->company = $company;
2021-02-14 12:09:32 +01:00
}
public function build()
{
2021-06-29 11:46:40 +02:00
App::forgetInstance('translator');
/* Init a new copy of the translator*/
$t = app('translator');
/* Set the locale*/
App::setLocale($this->company->getLocale());
/* Set customized translations _NOW_ */
$t->replace(Ninja::transformTranslations($this->company->settings));
$this->user->confirmation_code = $this->createDbHash($this->company->db);
$this->user->save();
2021-02-14 12:09:32 +01:00
$data = [
'title' => ctrans('texts.confirmation_subject'),
'message' => ctrans('texts.confirmation_message'),
'url' => url("/user/confirm/{$this->user->confirmation_code}"),
'button' => ctrans('texts.button_confirmation_message'),
'settings' => $this->company->settings,
2021-02-14 12:36:36 +01:00
'logo' => $this->company->present()->logo(),
'signature' => $this->company->settings->email_signature,
2021-02-14 12:09:32 +01:00
];
$mail_obj = new \stdClass;
$mail_obj->subject = ctrans('texts.confirmation_subject');
$mail_obj->data = $data;
$mail_obj->markdown = 'email.admin.generic';
$mail_obj->tag = $this->company->company_key;
2022-03-04 01:45:19 +01:00
$mail_obj->text_view = 'email.admin.verify_user_text';
2021-02-14 12:09:32 +01:00
return $mail_obj;
}
}