Skip to content

Commit

Permalink
Fix tests error
Browse files Browse the repository at this point in the history
  • Loading branch information
DidierViret committed Jun 28, 2024
1 parent 8d46d16 commit f377fcc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions orif/user/Controllers/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function azure_login() {
$url .= "&redirect_uri=" . urlencode($redirect_uri);

// Redirection to Microsoft's login page
return redirect()->to($url);
return $this->response->redirect($url)->send();

// Second stage of the authentication process
} elseif (isset($_GET["error"])) {
Expand Down Expand Up @@ -416,7 +416,6 @@ public function verify_verification_code() {
} else {

// User already in DB => Update azure_mail in DB

$ci_user = $this->user_model->where('email', $_SESSION['form_email'])->first();

// Verification code matches
Expand All @@ -439,6 +438,7 @@ public function verify_verification_code() {

if ($_SESSION['verification_attempts'] <= 0) {
// No more attempts, keep default user access, reset some session variables and redirect to after_login_redirect
return $this->reset_session();
} else {
$output = array(
'title' => lang('user_lang.title_validation_code'),
Expand All @@ -454,10 +454,6 @@ public function verify_verification_code() {
);
}
}

// todo redirect to reset sessions method
return $this->reset_session();

}

public function register_user() {
Expand Down
4 changes: 2 additions & 2 deletions tests/orif/user/Controllers/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ public function test_azure_mail_with_correct_code_existing_user(): void
$_SESSION['timer_end'] = time() + 300; // force timer_end to be greater than time()
$_SESSION['after_login_redirect'] = base_url();
$_SESSION['new_user'] = false;
$_SESSION['azure_mail'] = "azure@azurefake.fake";
$_SESSION['form_email'] = "fake@azurefake.fake";
$_SESSION['azure_mail'] = "fake@azurefake.fake";
$_SESSION['form_email'] = "fake@fake.fake";

$result = $this->controller(Auth::class)
->execute('verify_verification_code');
Expand Down

0 comments on commit f377fcc

Please sign in to comment.