User login controller action

@return Template
495118
public function login()
    {
        $this->dataCollection->add('meta', Config::getInstance()->get('Eureka\Global\Meta'));

        $hasError = false;

        $server  = Http\Server::getInstance();
        $session = Http\Session::getInstance();
        $email   = '';

        if ($server->isPost()) {

            try {

                $userMapper = new UserMapper(Database::get('user'));

                $post = Http\Post::getInstance();
                $user = $userMapper->findByEmail($email = $post->get('email'));
                $user->login(new Password($post->get('password')));

                $session->set('id',    $user->getId());
                $session->set('email', $user->getEmail());


                $server->redirect('/');

            } catch (LoginException $exception) {
                $this->dataCollection->add('error', 'Incorrect login or password!');
                $hasError = true;
            }
        }

        $this->dataCollection->add('email', $email);
        $this->dataCollection->add('hasError', $hasError);

        $this->setThemeLayoutTemplate($this->userLayoutPath . '/Login');

        return $this->getResponse('Login');
    }
940272
protected function login()
    {
        // Perform a request with the login credentials in the request header.
        $response = $this->client->get('services/login', [
            'headers' => ['username'=> $this->username, 'password' => $this->password],
        ]);

        // Parse the response body.
        $json = json_decode($response->getBody());
        $body = $json->{'nl.divide.iq'};
        $expire = new \DateTime($body->expiration_date, new \DateTimezone('UTC'));

        // Store the authentication token in the object.
        $this->authToken = new Token($body->authentication_token, $expire);

        return $this;
    }
966907
protected function execLoginForm()
    {
        $this->loadTranslations('form', sprintf('private/global/locales/%s/form.ini', LANGUAGE));
        $this->templateParameters['translations'] = $this->translations;
        $this->renderTemplate();
    }
920438
public function getUsersLogin()
    {
        Piwik::checkUserHasSomeAdminAccess();

        $logins = $this->model->getUsersLogin();
        $logins = $this->userFilter->filterLogins($logins);

        return $logins;
    }
1127979
public function LoginForm()
    {
        $form = CheckoutLoginForm::create($this, 'LoginForm');
        $form->setAttribute("action", $this->Link("LoginForm"));

        $form
            ->Fields()
            ->add(HiddenField::create("BackURL")->setValue($this->Link()));

        $form
            ->Actions()
            ->dataFieldByName('action_dologin')
            ->addExtraClass("btn btn-primary");

        $this->extend("updateLoginForm", $form);

        return $form;
    }
1205975
public function getLogin()
    {
        if ($this->guard()->check()) {
            return redirect($this->redirectPath());
        }

        return view($this->loginView);
    }
256297
public function defaultAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, $this->getModuleCode(), AccessManager::VIEW)) {
            return $response;
        }

        return $this->renderList();
    }
409496
public function actionLogin()
    {
        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        } else {
            $model->password = '';

            return $this->render('login', [
                'model' => $model,
            ]);
        }
    }
158855
public function login()
    {
        $this->loadModel('User.Users');
        $this->viewBuilder()->layout('login');

        if ($this->request->is('post')) {
            $loginBlocking =
                plugin('User')->settings('failed_login_attempts') &&
                plugin('User')->settings('failed_login_attempts_block_seconds');
            $continue = true;

            if ($loginBlocking) {
                Cache::config('users_login', [
                    'duration' => '+' . plugin('User')->settings('failed_login_attempts_block_seconds') . ' seconds',
                    'path' => CACHE,
                    'engine' => 'File',
                    'prefix' => 'qa_',
                    'groups' => ['acl']
                ]);

                $cacheName = 'login_failed_' . env('REMOTE_ADDR');
                $cache = Cache::read($cacheName, 'users_login');

                if ($cache && $cache['attempts'] >= plugin('User')->settings('failed_login_attempts')) {
                    $blockTime = (int)plugin('User')->settings('failed_login_attempts_block_seconds');
                    $this->Flash->warning(__d('user', 'You have reached the maximum number of login attempts. Try again in {0} minutes.', $blockTime / 60));
                    $continue = false;
                }
            }

            if ($continue) {
                $user = $this->Auth->identify();
                if ($user) {
                    $this->Auth->setUser($user);
                    if (!empty($user['id'])) {
                        try {
                            $user = $this->Users->get($user['id']);
                            if ($user) {
                                $this->Users->touch($user, 'Users.login');
                                $this->Users->save($user);
                            }
                        } catch (\Exception $e) {
                            // invalid user
                        }
                    }

                    return $this->redirect($this->Auth->redirectUrl());
                } else {
                    if ($loginBlocking && isset($cache) && isset($cacheName)) {
                        $cacheStruct = [
                            'attempts' => 0,
                            'last_attempt' => 0,
                            'ip' => '',
                            'request_log' => []
                        ];
                        $cache = array_merge($cacheStruct, $cache);
                        $cache['attempts'] += 1;
                        $cache['last_attempt'] = time();
                        $cache['ip'] = env('REMOTE_ADDR');
                        $cache['request_log'][] = [
                            'data' => $this->request->data,
                            'time' => time(),
                        ];
                        Cache::write($cacheName, $cache, 'users_login');
                    }
                    $this->Flash->danger(__d('user', 'Username or password is incorrect.'));
                }
            }
        }

        $user = $this->Users->newEntity();

        $this->title(__d('user', 'Login'));
        $this->set(compact('user'));
    }
509003
public function loginAction()
    {
        $form = new LoginForm();

        try {

            if (!$this->request->isPost()) {

                if ($this->auth->hasRememberMe()) {
                    return $this->auth->loginWithRememberMe();
                }
            } else {

                if ($form->isValid($this->request->getPost()) == false) {
                    foreach ($form->getMessages() as $message) {
                        $this->flash->error($message);
                    }
                } else {

                    $this->auth->check([
                        'email' => $this->request->getPost('email'),
                        'password' => $this->request->getPost('password'),
                        'remember' => $this->request->getPost('remember')
                    ]);

                    return $this->response->redirect('dashboard');
                }
            }
        } catch (AuthException $e) {
            $this->flash->error($e->getMessage());
        }

        $this->view->form = $form;
    }
154765
public function admin()
    {
        $currentuser = $this->getUser();
        $users = $this->users()->getUsers();
        $sessions = $this->accessControl()->getActiveSessions();

        foreach ($users as $name => $user) {
            if (($key = array_search(Permissions::ROLE_EVERYONE, $user['roles'], true)) !== false) {
                unset($users[$name]['roles'][$key]);
            }
        }

        $context = [
            'currentuser' => $currentuser,
            'users'       => $users,
            'sessions'    => $sessions,
        ];

        return $this->render('@bolt/users/users.twig', $context);
    }
562559
public function actionLogin()
    {
        if (! Yii::$app->getUser()->getIsGuest()) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->getRequest()->post()) && $model->login()) {
            return $this->goBack();
        } else {
            yii::$app->getUser()->setReturnUrl(yii::$app->getRequest()->getHeaders()->get('referer'));
            return $this->render('login', [
                'model' => $model,
            ]);
        }
    }
1210135
public function render()
    {
        parent::render();

        // performing redirect if needed
        $this->redirectAfterLogin();

        // is logged in ?
        $user = $this->getUser();
        $passwordField = 'oxuser__oxpassword';
        if (!$user || ($user && !$user->$passwordField->value) ||
            ($this->isEnabledPrivateSales() && $user && (!$user->isTermsAccepted() || $this->confirmTerms()))
        ) {
            $this->_sThisTemplate = $this->_getLoginTemplate();
        }

        return $this->_sThisTemplate;
    }
74092
public function buildTemplateAction()
    {
        $action = [
            'type' => ActionType::POSTBACK,
            'label' => $this->label,
            'data' => $this->data,
        ];

        if (isset($this->displayText)) {
            // If text is set, append extend field.
            $action['displayText'] = $this->displayText;
        }

        return $action;
    }
783062
public function loginWith()
    {
        $providerName = $_REQUEST["provider"];
        $redirect = $_GET['redirect'];

        $userProfile = $this->getAuthProvider()->authenticate($providerName);

        if ($userProfile instanceof Exception) {
            $this->getView()->set('exception', $userProfile);
        } else {
            $userExist = User_Logins::instance()->getUserByProvider($providerName, $userProfile->identifier);

            if (!$userExist) {
                $this->redirect(
                    $this->getModelManager()->getOAuthLinkURL([
                        'provider' => $providerName,
                        'redirect' => $redirect
                    ]));
            }

            $userExist->doAuthentication();

            $this->afterLoginRedirect();
        }
    }
290997
public function print_login() {
        $client = $this->get_user_oauth_client();
        $loginurl = $client->get_login_url();
        if ($this->options['ajax']) {
            $ret = array();
            $btn = new \stdClass();
            $btn->type = 'popup';
            $btn->url = $loginurl->out(false);
            $ret['login'] = array($btn);
            return $ret;
        } else {
            echo html_writer::link($loginurl, get_string('login', 'repository'),
                    array('target' => '_blank',  'rel' => 'noopener noreferrer'));
        }
    }
943984
public function postLogin()
    {
        $remember = Input::get('remember_me', false);
        $userdata = array(
            Config::get('cartalyst/sentry::users.login_attribute') => Input::get('login_attribute'),
            'password' => Input::get('password')
        );

        if ( $this->userForm->login($userdata,$remember) )
        {
            return Redirect::intended(Config::get('cpanel::prefix', 'admin'))
                ->with('success', Lang::get('cpanel::users.login_success'));
        }

        return Redirect::back()
            ->withInput()
            ->with('login_error',$this->userForm->getErrors()->first());


    }