Skip to content

Commit

Permalink
Fixing site controller post conflict resolution between EYE-684 and E…
Browse files Browse the repository at this point in the history
…YE-688 (#7016)
  • Loading branch information
fraser-nds authored Nov 4, 2021
1 parent 51d67ab commit 6f1e440
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions protected/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public function actionChangeSiteAndFirm()
$this->renderPartial('/site/change_site_and_firm', array('returnUrl' => $return_url), false, true);
}

public function authSourceIsSSO()
{
return Yii::app()->params['auth_source'] === 'SAML' || Yii::app()->params['auth_source'] === 'OIDC';
}

/**
* Displays the login page.
*/
Expand Down Expand Up @@ -149,12 +154,11 @@ public function actionLogin()
}

$model = new LoginForm();
$authSourceSAMLOrOIDC = Yii::app()->params['auth_source'] === 'SAML' || Yii::app()->params['auth_source'] === 'OIDC';

// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
if (!$authSourceSAMLOrOIDC || in_array($model->username, Yii::app()->params['local_users'])) {
if (!$this->authSourceIsSSO() || in_array($model->username, Yii::app()->params['local_users'])) {
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
// Flag site for confirmation
Expand All @@ -169,17 +173,11 @@ public function actionLogin()
}
}
}
if ($authSourceSAMLOrOIDC) {
if ($this->authSourceIsSSO()) {
// User signing-in through portal should not be shown default OE login screen
return $this->render('/sso/sso_login', array());
return $this->render('/sso/sso_login', array('sso_login_url' => Yii::app()->createUrl('sso/login')));
}

$institution = Institution::model()->getCurrent();

$criteria = new CDbCriteria();
$criteria->compare('institution_id', $institution->id);
$criteria->order = 'short_name asc';

// display the login form
$this->render(
'login',
Expand Down

0 comments on commit 6f1e440

Please sign in to comment.