app/Http/Controllers/Auth/LoginController.php
public function loginAction(ServerRequestInterface $request, UpgradeService $upgrade_service): ResponseInterface
    {
        $username = $request->get('username', '');
        $password = $request->get('password', '');
        $url      = $request->get('url', '');

        try {
            $this->doLogin($username, $password);

            if (Auth::isAdmin() && $upgrade_service->isUpgradeAvailable()) {
                FlashMessages::addMessage(I18N::translate('A new version of webtrees is available.') . ' <a class="alert-link" href="' . e(route('upgrade')) . '">' . I18N::translate('Upgrade to webtrees %s.', '<span dir="ltr">' . $upgrade_service->latestVersion() . '</span>') . '</a>');
            }

            // If there was no referring page, redirect to "my page".
            if ($url === '') {
                // Switch to a tree where we have a genealogy record (or keep to the current/default).
                $ged = (string) DB::table('gedcom')
                    ->join('user_gedcom_setting', 'gedcom.gedcom_id', '=', 'user_gedcom_setting.gedcom_id')
                    ->where('user_id', '=', Auth::id())
                    ->value('gedcom_name');

                $url = route('tree-page', ['ged' => $ged]);
            }

            // Redirect to the target URL
            return redirect($url);
        } catch (Exception $ex) {
            // Failed to log in.
            return redirect(route('login', [
                'username' => $username,
                'url'      => $url,
                'error'    => $ex->getMessage(),
            ]));
        }
    }
public function loginAction(ServerRequestInterface $request, UpgradeService $upgrade_service): ResponseInterface
    {
        $username = $request->get('username', '');
        $password = $request->get('password', '');
        $url      = $request->get('url', '');

        try {
            $this->doLogin($username, $password);

            if (Auth::isAdmin() && $upgrade_service->isUpgradeAvailable()) {
                FlashMessages::addMessage(I18N::translate('A new version of webtrees is available.') . ' <a class="alert-link" href="' . e(route('upgrade')) . '">' . I18N::translate('Upgrade to webtrees %s.', '<span dir="ltr">' . $upgrade_service->latestVersion() . '</span>') . '</a>');
            }

            // If there was no referring page, redirect to "my page".
            if ($url === '') {
                // Switch to a tree where we have a genealogy record (or keep to the current/default).
                $ged = (string) DB::table('gedcom')
                    ->join('user_gedcom_setting', 'gedcom.gedcom_id', '=', 'user_gedcom_setting.gedcom_id')
                    ->where('user_id', '=', Auth::id())
                    ->value('gedcom_name');

                $url = route('tree-page', ['ged' => $ged]);
            }

            // Redirect to the target URL
            return redirect($url);
        } catch (Exception $ex) {
            // Failed to log in.
            return redirect(route('login', [
                'username' => $username,
                'url'      => $url,
                'error'    => $ex->getMessage(),
            ]));
        }
    }
public function loginAction ( ServerRequestInterface $ request , UpgradeService $ upgrade_service ) : ResponseInterface { $ username = $ request -> get ( 'username' , '' ) ; $ password = $ request -> get ( 'password' , '' ) ; $ url = $ request -> get ( 'url' , '' ) ; try { $ this -> doLogin ( $ username , $ password ) ; if ( Auth :: isAdmin ( ) && $ upgrade_service -> isUpgradeAvailable ( ) ) { FlashMessages :: addMessage ( I18N :: translate ( 'A new version of webtrees is available.' ) . ' <a class="alert-link" href="' . e ( route ( 'upgrade' ) ) . '">' . I18N :: translate ( 'Upgrade to webtrees %s.' , '<span dir="ltr">' . $ upgrade_service -> latestVersion ( ) . '</span>' ) . '</a>' ) ; } // If there was no referring page, redirect to "my page". if ( $ url === '' ) { // Switch to a tree where we have a genealogy record (or keep to the current/default). $ ged = ( string ) DB :: table ( 'gedcom' ) -> join ( 'user_gedcom_setting' , 'gedcom.gedcom_id' , '=' , 'user_gedcom_setting.gedcom_id' ) -> where ( 'user_id' , '=' , Auth :: id ( ) ) -> value ( 'gedcom_name' ) ; $ url = route ( 'tree-page' , [ 'ged' => $ ged ] ) ; } // Redirect to the target URL return redirect ( $ url ) ; } catch ( Exception $ ex ) { // Failed to log in. return redirect ( route ( 'login' , [ 'username' => $ username , 'url' => $ url , 'error' => $ ex -> getMessage ( ) , ] ) ) ; } }
Perform a login.

@param ServerRequestInterface $request
@param UpgradeService         $upgrade_service

@return ResponseInterface
Perform a login .