Skip to content

Commit

Permalink
Merge pull request Internet2#66 from ioigoume/IMPROVEMENT_Redirect_Us…
Browse files Browse the repository at this point in the history
…er_to_dashboard_if_member_in_only_one_CO

IMPROVEMENT_Redirect_User_to_dashboard_if_member_in_only_one_CO
  • Loading branch information
NicolasLiampotis authored Sep 7, 2020
2 parents 21e1509 + bfd2830 commit cd18a58
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Changed the way we load plugins from config. This extention will allow plugins to inject bootstrapping and routes
- Increased CO Localization text field capacity.
- Improved user's graphical interaction during Enrollment Flow
- Redirect User to CO dashboard if member in only one CO.

### Fixed
- Prevent users from submitting multiple registration requests
Expand Down
10 changes: 9 additions & 1 deletion app/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,15 @@ public function login() {
// Note we're performing CO specific work here, even though we're not in a CO context yet.

$this->OrgIdentitySource->syncByIdentifier($u);


if(count($cos) === 1 && $this->Auth->redirectUrl() === '/') {
$args = array();
$args['plugin'] = null;
$args['controller'] = 'co_dashboards';
$args['action'] = 'dashboard';
$args['co'] = $co["co_id"];
$this->redirect($args);
}
$this->redirect($this->Auth->redirectUrl());
} else {
// This is an API user. We don't do anything special at the moment, other
Expand Down
7 changes: 7 additions & 0 deletions app/webroot/auth/login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
exit;
}

// XXX if we define no redirect path, e.g. to an internal path: co_dashboards/configuration/co:2 then CAKEPHP thinks that should come back here
// XXX as a result adds to the SESSION auth/login as the redirect path after login. This causes the login to happen twice for the case we are
// XXX visiting the COmanage homepage
if(empty($_SESSION["Auth"]["redirect"])) {
$_SESSION["Auth"]["redirect"] = '/';
}

?>
<!DOCTYPE html>
<html lang="en">
Expand Down

0 comments on commit cd18a58

Please sign in to comment.