public function postSignin()
    {
        $isEmail = preg_match('/@/', Input::get('email'));

        // Declare the rules for the form validation
        $rules = array(
            'email' => 'required|email',
            'password' => 'required|between:3,32',
        );

        if (!$isEmail)
            $rules['email'] = 'required';

        // Create a new validator instance from our validation rules
        $validator = Validator::make(Input::all(), $rules);

        // If validation fails, we'll exit the operation now.
        if ($validator->fails()) {
            // Ooops.. something went wrong
            return back()->withInput()->withErrors($validator);
        }
        try {
            foreach(Sentinel::createModel()->getLoginNames() as $loginName)
            {
                $data = array(
                    $loginName => Input::only('email')["email"],
                    "password" => Input::only('password')["password"]
                );

                // Try to log the user in
                if(Sentinel::authenticate($data, Input::get('remember-me', false)))
                {
                    $user = Sentinel::check();
                    $user->update(['ip' => Request::ip()]);
                    Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') logged in with IP ' . Request::ip() );
                    
                    // Redirect to the dashboard page
                    return Redirect::route("home")->with('success', Lang::get('base.auth.signin.success'));
                }
            }

            $this->messageBag->add('email', Lang::get('base.auth.account.not_found'));
        } catch (NotActivatedException $e) {
            $this->messageBag->add('email', Lang::get('base.auth.account.not_activated'));
        } catch (ThrottlingException $e) {
            $delay = $e->getDelay();
            $this->messageBag->add('email', Lang::get('base.auth.account.suspended', compact('delay' )));
        }
        Base::Log('Login attempt registred for ' . Input::only('email')["email"] . ' from IP ' . Request::ip() );

        // Ooops.. something went wrong
        return back()->withInput()->withErrors($this->messageBag);
    }