You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/09/04 09:37:23 UTC
airavata-php-gateway git commit: moving Airavata connection check to
post login
Repository: airavata-php-gateway
Updated Branches:
refs/heads/master ac5759ec7 -> 2f3f5adc6
moving Airavata connection check to post login
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/2f3f5adc
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/2f3f5adc
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/2f3f5adc
Branch: refs/heads/master
Commit: 2f3f5adc69cf08390d7a6e94bd683f9bde4393ba
Parents: ac5759e
Author: Supun Nakandala <sc...@apache.org>
Authored: Fri Sep 4 12:40:23 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Fri Sep 4 12:40:23 2015 +0530
----------------------------------------------------------------------
app/config/pga_config.php.template | 5 +++++
app/controllers/AccountController.php | 36 +++++++++++++++++-------------
app/filters.php | 5 -----
3 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2f3f5adc/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 72b745b..316b96b 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -39,6 +39,11 @@ return array(
'auth-mode' => 'basic',
/**
+ * WSO2 OAuth Service Provider Application ID
+ */
+ 'oauth-service-provider-id' => 'OpenidConnectWebapp-local',
+
+ /**
* OAuth client key
*/
'oauth-client-key' => 'iGEREhSBLuGapdcXwMU0b8jEpA4a',
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2f3f5adc/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 9793c5e..c8f66a5 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -111,22 +111,15 @@ class AccountController extends BaseController
$username = $userProfile['username'];
CommonUtilities::store_id_in_session($username);
- CommonUtilities::print_success_message('Login successful! You will be redirected to your home page shortly.');
Session::put("gateway_id", Config::get('pga_config.airavata')['gateway-id']);
- //creating a default project for user
- $projects = ProjectUtilities::get_all_user_projects(Config::get('pga_config.airavata')['gateway-id'], $username);
- if($projects == null || count($projects) == 0){
- //creating a default project for user
- ProjectUtilities::create_default_project($username);
- }
+ $this->initializeWithAiravata($username);
return Redirect::to("home");
}
public function loginSubmit()
{
-
if (CommonUtilities::form_submitted()) {
$username = $_POST['username'];
$password = $_POST['password'];
@@ -146,15 +139,9 @@ class AccountController extends BaseController
}
CommonUtilities::store_id_in_session($username);
- CommonUtilities::print_success_message('Login successful! You will be redirected to your home page shortly.');
Session::put("gateway_id", Config::get('pga_config.airavata')['gateway-id']);
- //creating a default project for user
- $projects = ProjectUtilities::get_all_user_projects(Config::get('pga_config.airavata')['gateway-id'], $username);
- if($projects == null || count($projects) == 0){
- //creating a default project for user
- ProjectUtilities::create_default_project($username);
- }
+ $this->initializeWithAiravata($username);
return Redirect::to("home");
@@ -168,6 +155,25 @@ class AccountController extends BaseController
}
+ private function initializeWithAiravata($username){
+
+ //Check Airavata Server is up
+ try{
+ $apiVersion = Airavata::getAPIVersion();
+ if (empty($apiVersion))
+ return View::make("server-down");
+ }catch (Exception $ex){
+ return View::make("server-down");
+ }
+
+ //creating a default project for user
+ $projects = ProjectUtilities::get_all_user_projects(Config::get('pga_config.airavata')['gateway-id'], $username);
+ if($projects == null || count($projects) == 0){
+ //creating a default project for user
+ ProjectUtilities::create_default_project($username);
+ }
+ }
+
public function forgotPassword()
{
return View::make("account/forgot-password");
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2f3f5adc/app/filters.php
----------------------------------------------------------------------
diff --git a/app/filters.php b/app/filters.php
index ce391a0..97c6d63 100755
--- a/app/filters.php
+++ b/app/filters.php
@@ -12,11 +12,6 @@
*/
App::before(function ($request) {
- //Check Airavata Server is up
-// $apiVersion = Airavata::getAPIVersion();
-// if (empty($apiVersion))
-// return View::make("server-down");
-
//Check OAuth token has expired
if(Config::get('pga_config.wsis')['auth-mode']=="oauth" && Session::has('authz-token')){
$currentTime = time();