Can login.

@return bool
16345
public function canLogin()
    {
        $subscriber_id = AnRequest::get('session.subscriber_id', 'cmd');

        if ($subscriber_id) {
            $this->person = $this->getService('repos:people.person')->find($subscriber_id);
        }

        return !is_null($this->person);
    }
1094982
public function login()
    {
        $module = UsersModule::module();
        if ($this->validate()) {
            return $this->user->login($this->rememberMe ? $module->loginDuration : 0);
        } else {
            return false;
        }
    }
1269331
protected function doLogin()
    {
        $connection = $this->connection;
        $user = $this->getParam('user');
        $password = $this->getParam('pass');

        return $this->retry(function () use ($connection, $user, $password) {
            $res = @ftp_login($connection, $user, $password);

            if (!$res) {
                throw new \RuntimeException("Login failed for user: ".$user);
            }
        });
    }
1172921
public function login()
    {
        $identity = $this->getIdentity();

        if ($identity->authenticate($this->newPassword)) {
            return $this->webUser->login($identity, 0);
        }

        return false;
    }
1146390
protected function canAccess()
    {
        $result = false;
        $page = Page::getByPath('/dashboard/system/basics/editor');
        if ($page && !$page->isError()) {
            $checker = new Checker($page);
            $result = $checker->canViewPage();
        }

        return $result;
    }
1245475
public function isLogined()
    {
        $session = $this->getSession();
        $cookie = $this->getCookie();

        if ($cookie->has(self::USER_SESSION)) {
            $login = $cookie->get(self::USER_SESSION);
            $login = unserialize(base64_decode($login));
        }elseif (false !== $session->has(self::USER_SESSION)) {
            $login = $session->get(self::USER_SESSION);
        }else{
            return false;
        }

        return $this->isSameIp($login);
    }
251726
public static function canUseSession()
    {
        // Get the session driver and check if it was started - fully inited by laravel
        $session = session();
        $driver = $session->getDefaultDriver();
        $drivers = $session->getDrivers();

        // Check if the driver is valid and started - allow using session
        if (isset($drivers[$driver]) && true === $drivers[$driver]->isStarted()) {
            return true;
        }

        return false;
    }
360623
public function getSeperateLogin()
    {
        if (!$this->seperateLoginAttribute || empty($this->seperateLoginAttribute)) {
            return false;
        }
        $enableLoginAttribute = $this->seperateLoginAttribute;
        return $this->$enableLoginAttribute > 0;
    }
1263566
public function canRead()
    {
        if ($this->getRequest()->get('layout') == 'add') {
            return $this->_mixer->canAdd();
        }

        if ($this->getItem() && $this->getItem()->authorize('access')) {
            return true;
        }

        return false;
    }
132592
final protected function _canChangePassword() {
         //validate that required indices exist
        if (!isset($this->_userProfile['username'])
            || !isset($this->_userProfile['password'])
            || !isset($this->_userProfile['fullname'])
            || !isset($this->_userProfile['passhist'])
        ) {
            throw new UserCredentialException('The username and password are not set', 1016);
        }
  
        //Verify if the password was changed today or server has been futuredated
        $currDateTimeObj = new \DateTime();
        
        //Password was changed today or in the future
        if ($currDateTimeObj <= $this->_userProfile['policyinfo']['password_last_changed_datetime']) {
            return false;
        } else {
            return true;
        }
    }
501388
public function isAccessible()
    {
        $root = $this->getRootParagraph();

        if ( ! empty( $root->allAccess ) )
        {
            return true;
        }

        $user = $this->getAuthenticatedUser();

        if ( empty( $user ) )
        {
            return ! empty( $root->accessUsers ) && in_array( '', $root->accessUsers )
                || ! empty( $root->accessGroups ) && in_array( '', $root->accessGroups );
        }

        return ! empty( $root->accessUsers ) && in_array( $user->id, $root->accessUsers )
            || ! empty( $root->accessGroups ) && in_array( $user->groupId, $root->accessGroups )
            || $this->getServiceLocator()
                    ->get( 'Grid\User\Model\Permissions\Model' )
                    ->isAllowed( $root, 'view' );
    }
1036469
public function isAccessible()
    {
        $loop = $this;
        $access = true;

        while ($loop->getReply() != null) {
            $loop = $loop->getReply();

            if ($loop->getSpam() == 1 || $loop->getActive() == 0 || $loop->isEmailValid() == 0) {
                $access = false;
            }
        }

        return $access;
    }
768055
public function login()
    {
        $success = false;
        if ($this->output && $this->input && $this->input->isInteractive()) {
            $method = $this->config()->getWithDefault('application.login_method', 'browser');
            if ($method === 'browser') {
                /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
                $questionHelper = $this->getService('question_helper');
                $urlService = $this->getService('url');
                if ($urlService->canOpenUrls()
                    && $questionHelper->confirm("Authentication is required.\nLog in via a browser?")) {
                    $this->stdErr->writeln('');
                    $exitCode = $this->runOtherCommand('auth:browser-login');
                    $this->stdErr->writeln('');
                    $success = $exitCode === 0;
                }
            } elseif ($method === 'password') {
                $exitCode = $this->runOtherCommand('auth:password-login');
                $this->stdErr->writeln('');
                $success = $exitCode === 0;
            }
        }
        if (!$success) {
            throw new LoginRequiredException();
        }
    }
934005
public function login(string $userID): bool
    {
        $data = Internal\Server::call('login', ['userID' => $userID], true);
        if (isset($data['result'])) {
            return $data['result'] === 'ok';
        }
        return false;
    }
529111
public static function is_login(){
        $user = self::sessionGet('user');
        if (empty($user)) {
            return false;
        } else {
            return  self::sessionGet('user_sign') == self::data_auth_sign($user) ? $user : false;
        }
    }
462061
protected function perform_login()
    {
        if (empty($this->email)) {
            $this->error = 601;
            return false;
        } elseif (empty($this->password)) {
            $this->error = 602;
            return false;
        } else {
            // Make some cookies. We all like cookies. Microsoft just likes them more.
            $this->add_cookie('.xbox.com', 'MC0', time(), '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_vi', '[CS]v1|26AD59C185011B4D-40000113004213F1[CE]', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_nr', '1297891791797', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_sess', '%20s_cc%3Dtrue%3B%20s_ria%3Dflash%252011%257Csilverlight%2520not%2520detected%3B%20s_sq%3D%3B', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_pers', '%20s_vnum%3D1352674046430%2526vn%253D4%7C1352674046430%3B%20s_lastvisit%3D1324587801077%7C1419195801077%3B%20s_invisit%3Dtrue%7C1324589873289%3B', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'UtcOffsetMinutes', '60', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'xbox_info', 't=6', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'PersistentId', '0a652e56e40f42caac3ac84fad02ed01', '/', time() + (60*60*24*365));

            // Send the data to Xbox and retrieve the response.
            $url = 'https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=12&ct=' . time() . '&rver=6.2.6289.0&wp=MBI_SSL&wreply=https:%2F%2Faccount.xbox.com:443%2Fpassport%2FsetCookies.ashx%3Frru%3Dhttps%253a%252f%252faccount.xbox.com%252fen-US%252f&lc=1033&id=292543&cbcxt=0';
            $result = $this->fetch_url($url, 'http://www.xbox.com/en-US/');

            $this->stack_trace[] = array(
                'url'      => $url,
                'postdata' => '',
                'result'   => $result
            );

            // More cookies...
            $this->add_cookie('.login.live.com', 'WLOpt', 'act=[1]', time() + (60*60*24*365));
            $this->add_cookie('.login.live.com', 'CkTst', 'G' . time(), '/', time() + (60*60*24*365));

            // Find the right parameters. We need this data for the next request.
            $url  = $this->find($result, 'urlPost:\'', '\',');
            $PPFT = $this->find($result, 'name="PPFT" id="i0327" value="', '"');
            $PPSX = $this->find($result, 'srf_sRBlob=\'', '\';');

            // Send the data back to Xbox and retrieve the response.
            $post_data = 'login=' . $this->email . '&passwd=' . $this->password . '&KMSI=1&mest=0&type=11&LoginOptions=3&PPSX=' . $PPSX . '&PPFT=' . $PPFT . '&idsbho=1&PwdPad=&sso=&i1=1&i2=1&i3=12035&i12=1&i13=1&i14=323&i15=3762&i18=__Login_Strings%7C1%2C__Login_Core%7C1%2C';
            $result = $this->fetch_url($url, 'https://login.live.com/login.srf', null, $post_data);

            $this->stack_trace[] = array(
                'url'       => $url,
                'post_data' => $post_data,
                'result'    => $result
            );

            // MOAR COOKIESSSSSSSS!!!
            $this->add_cookie('.live.com', 'wlidperf', 'throughput=3&latency=961&FR=L&ST=1297790188859', '/', time() + (60*60*24*365));
            $this->add_cookie('login.live.com', 'CkTst', time(), '/ppsecure/', time() + (60*60*24*365));

            $url  = $this->find($result, 'id="fmHF" action="', '"');
            $NAP  = $this->find($result, 'id="NAP" value="', '"');
            $ANON = $this->find($result, 'id="ANON" value="', '"');
            $t    = $this->find($result, 'id="t" value="', '"');

            $this->add_cookie('.xbox.com', 'ANON', $ANON, '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'NAP', $NAP, '/', time() + (60*60*24*365));

            // OK, last time we send data to Xbox and retrieve the response.
            $post_data = 'NAPExp=' . date('c', mktime(date('H'), date('i'), date('s'), date('n') + 1)) . '&NAP=' . $NAP . '&ANONExp=' . date('c', mktime(date('H'), date('i'), date('s'), date('n') + 1)) . '&ANON=' . $ANON . '&t=' . $t;
            $result = $this->fetch_url($url, '', 16, $post_data);

            $this->stack_trace[] = array(
                'url'       => $url,
                'post_data' => $post_data,
                'result'    => $result
            );

            $result = $this->fetch_url('https://account.xbox.com/en-US/social');

            // Make sure we got signed in...
            if (stripos($result, '<h3 class="feedSectionTitle">Activity feed</h3>') !== false) {
                $this->logged_in = true;
                return true;
            } else {
                $this->error = 600;
                $this->save_stack_trace();
                return false;
            }
			
        }
    }
1065641
public function canAdministrate()
    {
        $user = $this->getUser();
        if ($user->name == 'Guest' && $user->email == 'guest@example.com') {
            return false;
        }
        if (method_exists($user, 'isAdmin')) {
            return $user->isAdmin();
        }
        if (method_exists($user, 'can')) {
            return $user->can('administrate') || $user->can('admin');
        }
        // If no method of authorizing return false;
        return false;
    }