mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #7134 from turbo124/v5-develop
Fixes for contact login"
This commit is contained in:
commit
8a3c760593
@ -100,10 +100,18 @@ class ContactForgotPasswordController extends Controller
|
||||
|
||||
if(Ninja::isHosted() && $company = Company::where('company_key', $request->input('company_key'))->first())
|
||||
{
|
||||
$contact = ClientContact::where(['email' => $request->input('email'), 'company_id' => $company->id])->first();
|
||||
$contact = ClientContact::where(['email' => $request->input('email'), 'company_id' => $company->id])
|
||||
->whereHas('client', function ($query) {
|
||||
$query->where('is_deleted',0);
|
||||
})->first();
|
||||
}
|
||||
else {
|
||||
|
||||
$contact = ClientContact::where(['email' => $request->input('email')])
|
||||
->whereHas('client', function ($query) {
|
||||
$query->where('is_deleted',0);
|
||||
})->first();
|
||||
}
|
||||
else
|
||||
$contact = ClientContact::where(['email' => $request->input('email')])->first();
|
||||
|
||||
$response = false;
|
||||
|
||||
|
@ -98,7 +98,10 @@ class ContactLoginController extends Controller
|
||||
|
||||
if(Ninja::isHosted() && $request->has('password') && $company = Company::where('company_key', $request->input('company_key'))->first()){
|
||||
|
||||
$contact = ClientContact::where(['email' => $request->input('email'), 'company_id' => $company->id])->first();
|
||||
$contact = ClientContact::where(['email' => $request->input('email'), 'company_id' => $company->id])
|
||||
->whereHas('client', function ($query) {
|
||||
$query->where('is_deleted',0);
|
||||
})->first();
|
||||
|
||||
if(!$contact)
|
||||
return $this->sendFailedLoginResponse($request);
|
||||
|
@ -15,6 +15,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@ -55,9 +56,14 @@ class ResetPasswordController extends Controller
|
||||
|
||||
public function showResetForm(Request $request, $token = null)
|
||||
{
|
||||
$company = false;
|
||||
|
||||
MultiDB::findAndSetDbByCompanyKey($request->session()->get('company_key'));
|
||||
$company = Company::where('company_key', $request->session()->get('company_key'))->first();
|
||||
if(Ninja::isHosted()){
|
||||
|
||||
MultiDB::findAndSetDbByCompanyKey($request->session()->get('company_key'));
|
||||
$company = Company::where('company_key', $request->session()->get('company_key'))->first();
|
||||
|
||||
}
|
||||
|
||||
if($company)
|
||||
$account = $company->account;
|
||||
|
@ -35,7 +35,13 @@ class NinjaMailer extends Mailable
|
||||
public function build()
|
||||
{
|
||||
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name'))
|
||||
$from_name = config('mail.from.name');
|
||||
|
||||
if(property_exists($this->mail_obj, 'from_name')){
|
||||
$from_name = $this->mail_obj->from_name;
|
||||
}
|
||||
|
||||
return $this->from(config('mail.from.address'), $from_name)
|
||||
->subject($this->mail_obj->subject)
|
||||
->view($this->mail_obj->markdown, $this->mail_obj->data)
|
||||
->withSwiftMessage(function ($message) {
|
||||
|
@ -219,7 +219,7 @@ class NinjaMailerJob implements ShouldQueue
|
||||
$google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
|
||||
|
||||
//need to slow down gmail requests otherwise we hit 429's
|
||||
sleep(1);
|
||||
sleep(rand(1,3));
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
$this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
|
||||
|
@ -22,6 +22,7 @@ class ClientContactResetPasswordObject
|
||||
public $token;
|
||||
|
||||
private $company;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -52,12 +53,19 @@ class ClientContactResetPasswordObject
|
||||
'logo' => $this->company->present()->logo(),
|
||||
];
|
||||
|
||||
$email_from_name = config('mail.from.name');
|
||||
|
||||
if(property_exists($settings, 'email_from_name') && strlen($settings->email_from_name) > 1)
|
||||
$email_from_name = $settings->email_from_name;
|
||||
else
|
||||
$email_from_name = $this->company->present()->name();
|
||||
|
||||
$mail_obj = new \stdClass;
|
||||
$mail_obj->subject = ctrans('texts.your_password_reset_link');
|
||||
$mail_obj->data = $data;
|
||||
$mail_obj->markdown = 'email.client.generic';
|
||||
$mail_obj->tag = $this->company->company_key;
|
||||
$mail_obj->from_name = $email_from_name;
|
||||
|
||||
return $mail_obj;
|
||||
}
|
||||
|
@ -227,11 +227,11 @@ class BrowserPay implements MethodInterface
|
||||
if(Ninja::isHosted())
|
||||
{
|
||||
|
||||
if($this->company_gateway->company->portal_mode == 'domain'){
|
||||
$domain = $this->company_gateway->company->portal_domain;
|
||||
if($this->stripe->company_gateway->company->portal_mode == 'domain'){
|
||||
$domain = $this->stripe->company_gateway->company->portal_domain;
|
||||
}
|
||||
else{
|
||||
$domain = $this->company_gateway->company->subdomain . '.' . config('ninja.app_domain');
|
||||
$domain = $this->stripe->company_gateway->company->subdomain . '.' . config('ninja.app_domain');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class UpdatePaymentMethods
|
||||
],
|
||||
$this->stripe->stripe_connect_auth);
|
||||
|
||||
foreach($alipay_methods as $method)
|
||||
foreach($sofort_methods as $method)
|
||||
{
|
||||
$this->addOrUpdateCard($method, $customer->id, $client, GatewayType::SOFORT);
|
||||
}
|
||||
|
@ -97,12 +97,12 @@ return [
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
|
||||
// 'options' => Ninja::isHosted() ? config('ninja.db_options') : [],
|
||||
'options' => [
|
||||
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
|
||||
PDO::MYSQL_ATTR_SSL_KEY => env("DB_CLIENT_KEY", ''),
|
||||
PDO::MYSQL_ATTR_SSL_CERT => env("DB_CLIENT_CERT", ''),
|
||||
PDO::MYSQL_ATTR_SSL_CA => env("DB_CA_CERT", ''),
|
||||
],
|
||||
// 'options' => [
|
||||
// PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
|
||||
// PDO::MYSQL_ATTR_SSL_KEY => env("DB_CLIENT_KEY", ''),
|
||||
// PDO::MYSQL_ATTR_SSL_CERT => env("DB_CLIENT_CERT", ''),
|
||||
// PDO::MYSQL_ATTR_SSL_CA => env("DB_CA_CERT", ''),
|
||||
// ],
|
||||
],
|
||||
|
||||
'db-ninja-01a' => [
|
||||
@ -118,7 +118,6 @@ return [
|
||||
'prefix_indexes' => true,
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
|
||||
'ssl_mode' => env('SSL_MODE',''), //required
|
||||
// 'options' => Ninja::isHosted() ? config('ninja.db_options') : [],
|
||||
],
|
||||
|
||||
@ -135,7 +134,6 @@ return [
|
||||
'prefix_indexes' => true,
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
|
||||
'ssl_mode' => env('SSL_MODE',''),
|
||||
// 'options' => Ninja::isHosted() ? config('ninja.db_options') : [],
|
||||
],
|
||||
|
||||
@ -152,7 +150,6 @@ return [
|
||||
'prefix_indexes' => true,
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
|
||||
'ssl_mode' => env('SSL_MODE',''),
|
||||
// 'options' => Ninja::isHosted() ? config('ninja.db_options') : [],
|
||||
],
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user