fixed #369
This commit is contained in:
		@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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.',
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user