1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Log contact logins

This commit is contained in:
David Bomba 2019-07-10 11:50:49 +10:00
parent 9f624b3c61
commit 2f401e3457
3 changed files with 14 additions and 8 deletions

View File

@ -12,6 +12,7 @@
namespace App\Providers;
use App\Events\Client\ClientWasCreated;
use App\Events\Contact\ContactLoggedIn;
use App\Events\Invoice\InvoiceWasCreated;
use App\Events\Invoice\InvoiceWasMarkedSent;
use App\Events\Invoice\InvoiceWasUpdated;
@ -20,6 +21,7 @@ use App\Events\User\UserLoggedIn;
use App\Events\User\UserWasCreated;
use App\Listeners\Activity\CreatedClientActivity;
use App\Listeners\Activity\PaymentCreatedActivity;
use App\Listeners\Contact\UpdateContactLastLogin;
use App\Listeners\Invoice\CreateInvoiceActivity;
use App\Listeners\Invoice\CreateInvoiceInvitations;
use App\Listeners\Invoice\UpdateInvoiceActivity;
@ -41,6 +43,9 @@ class EventServiceProvider extends ServiceProvider
UserLoggedIn::class => [
UpdateUserLastLogin::class,
],
ContactLoggedIn::class => [
UpdateContactLastLogin::class,
],
// Clients
ClientWasCreated::class => [
CreatedClientActivity::class,

View File

@ -117,18 +117,18 @@ class MultiDatabaseUserProvider implements UserProvider
*/
public function retrieveByCredentials(array $credentials)
{
Log::error('retrieving by credentials');
//Log::error('retrieving by credentials');
if (empty($credentials) ||
(count($credentials) === 1 &&
array_key_exists('password', $credentials))) {
return;
}
Log::error('settings DB');
//Log::error('settings DB');
$this->setDefaultDatabase(false, $credentials['email'], false);
Log::error('set DB');
//Log::error('set DB');
// First we will add each credential element to the query as a where clause.
@ -147,7 +147,7 @@ class MultiDatabaseUserProvider implements UserProvider
$query->where($key, $value);
}
}
Log::error($query->count());
//Log::error($query->count());
return $query->first();
}
@ -162,7 +162,7 @@ Log::error($query->count());
{ Log::error('validateCredentials');
$plain = $credentials['password'];
Log::error($plain);
//Log::error($plain);
return $this->hasher->check($plain, $user->getAuthPassword());
}
@ -226,8 +226,8 @@ Log::error($query->count());
private function setDefaultDatabase($id = false, $email = false, $token = false) : void
{
Log::error('setting DB');
Log::error('model = '.$this->model);
//Log::error('setting DB');
//Log::error('model = '.$this->model);
foreach (MultiDB::getDbs() as $database) {
$this->setDB($database);
@ -246,7 +246,7 @@ Log::error('model = '.$this->model);
$user = $query->get();
if (count($user) >= 1) {
Log::error('found user, settings DB for EMAIL');
//Log::error('found user, settings DB for EMAIL');
break;
}

View File

@ -320,6 +320,7 @@ class CreateUsersTable extends Migration
$table->string('confirmation_code')->nullable();
$table->boolean('is_primary')->default(false);
$table->boolean('confirmed')->default(false);
$table->timestamp('last_login')->nullable();
$table->smallInteger('failed_logins')->nullable();
$table->string('oauth_user_id',100)->nullable()->unique();
$table->unsignedInteger('oauth_provider_id')->nullable()->unique();