This commit is contained in:
denisdulici 2018-06-02 16:53:02 +03:00
parent adc36b0202
commit 23dbc973a0
2 changed files with 15 additions and 2 deletions

View File

@ -16,9 +16,19 @@ class Login
*/ */
public function handle(ILogin $event) public function handle(ILogin $event)
{ {
// Set company id // Get first company
$company = $event->user->companies()->first(); $company = $event->user->companies()->first();
// Logout if no company assigned
if (!$company) {
auth()->logout();
flash(trans('auth.error.no_company'))->error();
return redirect('auth/login');
}
// Set company id
session(['company_id' => $company->id]); session(['company_id' => $company->id]);
// Save user login time // Save user login time

View File

@ -13,14 +13,17 @@ return [
'current_email' => 'Current Email', 'current_email' => 'Current Email',
'reset' => 'Reset', 'reset' => 'Reset',
'never' => 'never', 'never' => 'never',
'password' => [ 'password' => [
'current' => 'Password', 'current' => 'Password',
'current_confirm' => 'Password Confirmation', 'current_confirm' => 'Password Confirmation',
'new' => 'New Password', 'new' => 'New Password',
'new_confirm' => 'New Password Confirmation', 'new_confirm' => 'New Password Confirmation',
], ],
'error' => [ 'error' => [
'self_delete' => 'Error: Can not delete yourself!' 'self_delete' => 'Error: Can not delete yourself!',
'no_company' => 'Error: No company assigned to your account. Please, contact the system administrator.',
], ],
'failed' => 'These credentials do not match our records.', 'failed' => 'These credentials do not match our records.',