Jump to content

Авторизация с другой страницы!


Stinger2015
 Share

Recommended Posts

И так проблема следующая, после перехода с 4.2.8 , на 4.3.2, моя функция умерла и авторизация не проходит!

 


require_once './forum/init.php';

\IPS\Dispatcher\Build::i();
$lang = \IPS\Lang::load( \IPS\Lang::defaultLanguage() );
$member = \IPS\Member::loggedIn();
$member_id = $member->member_id;
$csrfKey = \IPS\Session::i()->csrfKey;

function doLogin( $username, $password, $rememberMe=true, $anonymous=false )
{

   $login = new \IPS\Login( \IPS\Http\Url::internal('') );
   $login->forms();

   try{
       $member = $login->authenticateStandard(array(
           'auth'     => $username,
           'password' => $password,
       ));	
   }


   catch( \IPS\Login\Exception $e )
   {
       return false;
   }

   if ( $anonymous and !\IPS\Settings::i()->disable_anonymous )
   {
       \IPS\Session::i()->setAnon();
       \IPS\Request::i()->setCookie( 'anon_login', 1 );
   }

   \IPS\Session::i()->setMember( $member );

   if ( $rememberMe )
   {
       $expire = new \IPS\DateTime;
       $expire->add( new \DateInterval( 'P7D' ) );
       \IPS\Request::i()->setCookie( 'member_id', $member->member_id, $expire );
       \IPS\Request::i()->setCookie( 'login_key', $member->member_login_key, $expire );

       if ( $anonymous and !\IPS\Settings::i()->disable_anonymous )
       {
           \IPS\Request::i()->setCookie( 'anon_login', 1, $expire );
       }
   }

  $member->memberSync( 'onLogin', array( \IPS\Login::getDestination() ) );	

  return $member;
}

 

Буду очень благодарен за помощь в решении проблемы.

Edited by Stinger2015
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...