Version 5.0.0 beta 9
This commit is contained in:
1 parent
214f649f1d
commit
56979f8ee8
202 files changed
+4403
-1123
No files matched your search
@@ -238,45 +238,52 @@ class login extends Controller
|
||||
{
|
||||
Output::i()->redirect( Url::internal( 'app=core&module=system&controller=login', 'front', 'login' ) );
|
||||
}
|
||||
|
||||
$details = json_decode( $_SESSION['linkAccounts'], TRUE );
|
||||
$member = Member::load( $details['member'] );
|
||||
if ( !$member->member_id )
|
||||
{
|
||||
Output::i()->redirect( Url::internal( 'app=core&module=system&controller=login', 'front', 'login' ) );
|
||||
}
|
||||
|
||||
|
||||
/* And then handler to link with */
|
||||
$handler = Handler::load( $details['handler'] );
|
||||
|
||||
|
||||
/* Init reauthentication */
|
||||
$login = new LoginClass( Url::internal( 'app=core&module=system&controller=login&do=link', 'front', 'login' )->setQueryString( 'ref', isset( Request::i()->ref ) ? Request::i()->ref : NULL ), LoginClass::LOGIN_REAUTHENTICATE );
|
||||
$login->reauthenticateAs = $member;
|
||||
$error = NULL;
|
||||
|
||||
/* If successful (or if there's no way to reauthenticate which would only happen if a login handler has been deleted)) complete the link... */
|
||||
try
|
||||
|
||||
/* Did we submit the merge form? */
|
||||
if( isset( Request::i()->mergeAccount ) and Request::i()->mergeAccount )
|
||||
{
|
||||
if ( $success = $login->authenticate() or ( !count( $login->usernamePasswordMethods() ) and !count( $login->buttonMethods() ) ) )
|
||||
{
|
||||
$handler->completeLink( $member, $details['details'] );
|
||||
|
||||
unset( $_SESSION['linkAccounts'] );
|
||||
|
||||
$destination = Request::i()->referrer( FALSE, TRUE ) ?: Url::internal( '' );
|
||||
|
||||
$success = new Success( $member, $handler );
|
||||
if ( $success->mfa() )
|
||||
Session::i()->csrfCheck();
|
||||
|
||||
/* If successful (or if there's no way to reauthenticate which would only happen if a login handler has been deleted)) complete the link... */
|
||||
try
|
||||
{
|
||||
if ( $success = $login->authenticate() or ( !count( $login->usernamePasswordMethods() ) and !count( $login->buttonMethods() ) ) )
|
||||
{
|
||||
$_SESSION['processing2FA'] = array( 'memberId' => $success->member->member_id, 'anonymous' => $success->anonymous, 'remember' => $success->rememberMe, 'destination' => (string) $destination, 'handler' => $success->handler->id );
|
||||
Output::i()->redirect( $destination->setQueryString( '_mfaLogin', 1 ) );
|
||||
$handler->completeLink( $member, $details['details'] ?? null );
|
||||
|
||||
unset( $_SESSION['linkAccounts'] );
|
||||
|
||||
$destination = Request::i()->referrer( FALSE, TRUE ) ?: Url::internal( '' );
|
||||
|
||||
$success = new Success( $member, $handler );
|
||||
if ( $success->mfa() )
|
||||
{
|
||||
$_SESSION['processing2FA'] = array( 'memberId' => $success->member->member_id, 'anonymous' => $success->anonymous, 'remember' => $success->rememberMe, 'destination' => (string) $destination, 'handler' => $success->handler->id );
|
||||
Output::i()->redirect( $destination->setQueryString( '_mfaLogin', 1 ) );
|
||||
}
|
||||
$success->process();
|
||||
Output::i()->redirect( $destination->setQueryString( '_fromLogin', 1 ) );
|
||||
}
|
||||
$success->process();
|
||||
Output::i()->redirect( $destination->setQueryString( '_fromLogin', 1 ) );
|
||||
}
|
||||
}
|
||||
catch ( Exception $e )
|
||||
{
|
||||
$error = $e->getMessage();
|
||||
catch ( Exception $e )
|
||||
{
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise show the reauthenticate form */
|
||||
|
||||
Reference in new issue
Block a user