app/Http/Controllers/Auth/LoginController.php
public function loginPage(ServerRequestInterface $request, ?Tree $tree): ResponseInterface
    {
        // Already logged in?
        if (Auth::check()) {
            $ged = $tree !== null ? $tree->name() : '';

            return redirect(route('user-page', ['ged' => $ged]));
        }

        $error    = $request->get('error', '');
        $url      = $request->get('url', '');
        $username = $request->get('username', '');

        $title = I18N::translate('Sign in');

        switch (Site::getPreference('WELCOME_TEXT_AUTH_MODE')) {
            case 1:
            default:
                $welcome = I18N::translate('Anyone with a user account can access this website.');
                break;
            case 2:
                $welcome = I18N::translate('You need to be an authorized user to access this website.');
                break;
            case 3:
                $welcome = I18N::translate('You need to be a family member to access this website.');
                break;
            case 4:
                $welcome = Site::getPreference('WELCOME_TEXT_AUTH_MODE_' . WT_LOCALE);
                break;
        }

        if (Site::getPreference('USE_REGISTRATION_MODULE') === '1') {
            $welcome .= ' ' . I18N::translate('You can apply for an account using the link below.');
        }

        $can_register = Site::getPreference('USE_REGISTRATION_MODULE') === '1';

        return $this->viewResponse('login-page', [
            'can_register' => $can_register,
            'error'        => $error,
            'title'        => $title,
            'url'          => $url,
            'username'     => $username,
            'welcome'      => $welcome,
        ]);
    }
public function loginPage(ServerRequestInterface $request, ?Tree $tree): ResponseInterface
    {
        // Already logged in?
        if (Auth::check()) {
            $ged = $tree !== null ? $tree->name() : '';

            return redirect(route('user-page', ['ged' => $ged]));
        }

        $error    = $request->get('error', '');
        $url      = $request->get('url', '');
        $username = $request->get('username', '');

        $title = I18N::translate('Sign in');

        switch (Site::getPreference('WELCOME_TEXT_AUTH_MODE')) {
            case 1:
            default:
                $welcome = I18N::translate('Anyone with a user account can access this website.');
                break;
            case 2:
                $welcome = I18N::translate('You need to be an authorized user to access this website.');
                break;
            case 3:
                $welcome = I18N::translate('You need to be a family member to access this website.');
                break;
            case 4:
                $welcome = Site::getPreference('WELCOME_TEXT_AUTH_MODE_' . WT_LOCALE);
                break;
        }

        if (Site::getPreference('USE_REGISTRATION_MODULE') === '1') {
            $welcome .= ' ' . I18N::translate('You can apply for an account using the link below.');
        }

        $can_register = Site::getPreference('USE_REGISTRATION_MODULE') === '1';

        return $this->viewResponse('login-page', [
            'can_register' => $can_register,
            'error'        => $error,
            'title'        => $title,
            'url'          => $url,
            'username'     => $username,
            'welcome'      => $welcome,
        ]);
    }
public function loginPage ( ServerRequestInterface $ request , ? Tree $ tree ) : ResponseInterface { // Already logged in? if ( Auth :: check ( ) ) { $ ged = $ tree !== null ? $ tree -> name ( ) : '' ; return redirect ( route ( 'user-page' , [ 'ged' => $ ged ] ) ) ; } $ error = $ request -> get ( 'error' , '' ) ; $ url = $ request -> get ( 'url' , '' ) ; $ username = $ request -> get ( 'username' , '' ) ; $ title = I18N :: translate ( 'Sign in' ) ; switch ( Site :: getPreference ( 'WELCOME_TEXT_AUTH_MODE' ) ) { case 1 : default : $ welcome = I18N :: translate ( 'Anyone with a user account can access this website.' ) ; break ; case 2 : $ welcome = I18N :: translate ( 'You need to be an authorized user to access this website.' ) ; break ; case 3 : $ welcome = I18N :: translate ( 'You need to be a family member to access this website.' ) ; break ; case 4 : $ welcome = Site :: getPreference ( 'WELCOME_TEXT_AUTH_MODE_' . WT_LOCALE ) ; break ; } if ( Site :: getPreference ( 'USE_REGISTRATION_MODULE' ) === '1' ) { $ welcome .= ' ' . I18N :: translate ( 'You can apply for an account using the link below.' ) ; } $ can_register = Site :: getPreference ( 'USE_REGISTRATION_MODULE' ) === '1' ; return $ this -> viewResponse ( 'login-page' , [ 'can_register' => $ can_register , 'error' => $ error , 'title' => $ title , 'url' => $ url , 'username' => $ username , 'welcome' => $ welcome , ] ) ; }
Show a login page.

@param ServerRequestInterface $request
@param Tree|null              $tree

@return ResponseInterface
Show a login page .