1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #6341 from turbo124/v5-develop

Fixes for IP and TOKEN insertion into activities
This commit is contained in:
David Bomba 2021-07-27 17:38:40 +10:00 committed by GitHub
commit 07f7106d37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 9 deletions

View File

@ -104,8 +104,13 @@ class ConnectedAccountController extends BaseController
$refresh_token = '';
$token = '';
$email = $google->harvestEmail($user);
if(auth()->user()->email != $email && MultiDB::checkUserEmailExists($email))
return response()->json(['message' => ctrans('texts.email_already_register')], 400)
$connected_account = [
'email' => $google->harvestEmail($user),
'email' => $email,
'oauth_user_id' => $google->harvestSubField($user),
'oauth_provider_id' => 'google',
'email_verified_at' =>now()

View File

@ -42,6 +42,9 @@ class UrlSetDb
$hashed_db = $hashids->decode($segments[0]);
if(!is_array($hashed_db))
return response()->json(['message' => 'Invalid confirmation code'], 403);
MultiDB::setDB(MultiDB::DB_PREFIX.str_pad($hashed_db[0], 2, '0', STR_PAD_LEFT));
}

View File

@ -53,6 +53,7 @@ class PreviewInvoiceRequest extends Request
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
$input['amount'] = 0;
$input['balance'] = 0;
$input['number'] = null;
$this->replace($input);
}

View File

@ -535,6 +535,7 @@ class Import implements ShouldQueue
$modified = $resource;
unset($modified['id']);
unset($modified['password']); //cant import passwords.
unset($modified['confirmation_code']); //cant import passwords.
$user = $user_repository->save($modified, $this->fetchUser($resource['email']), true, true);
$user->email_verified_at = now();

View File

@ -121,7 +121,7 @@ class EntitySentObject
ctrans(
$this->template_subject,
[
'client' => $this->contact->present()->name(),
'client' => $this->contact->client->present()->name(),
'invoice' => $this->entity->number,
]
);
@ -133,7 +133,7 @@ class EntitySentObject
$this->template_body,
[
'amount' => $this->getAmount(),
'client' => $this->contact->present()->name(),
'client' => $this->contact->client->present()->name(),
'invoice' => $this->entity->number,
]
);

View File

@ -229,7 +229,7 @@ class Client extends BaseModel implements HasLocalePreference
public function system_logs()
{
return $this->hasMany(SystemLog::class);
return $this->hasMany(SystemLog::class)->orderBy('id', 'desc');
}
public function timezone()

View File

@ -51,11 +51,11 @@ class ActivityRepository extends BaseRepository
}
if ($token_id = $this->getTokenId($event_vars)) {
$fields->token_id = $token_id;
$activity->token_id = $token_id;
}
$fields->ip = $event_vars['ip'];
$fields->is_system = $event_vars['is_system'];
$activity->ip = $event_vars['ip'];
$activity->is_system = $event_vars['is_system'];
$activity->save();

View File

@ -84,7 +84,7 @@ class CompanyLedgerTest extends TestCase
$settings = CompanySettings::defaults();
$settings->company_logo = asset('images/new_logo.png');
$settings->company_logo = 'https://app.invoiceninja.com/favicon-v2.png';
$settings->website = 'www.invoiceninja.com';
$settings->address1 = 'Address 1';
$settings->address2 = 'Address 2';

View File

@ -167,7 +167,7 @@ trait MockAccountData
$settings = CompanySettings::defaults();
$settings->company_logo = '';
$settings->company_logo = 'https://app.invoiceninja.com/favicon-v2.png';
// $settings->company_logo = asset('images/new_logo.png');
$settings->website = 'www.invoiceninja.com';
$settings->address1 = 'Address 1';