Renamed UpdateController.php to GatewayRequestUpdateController.php
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/b8439304 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/b8439304 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/b8439304 Branch: refs/heads/develop Commit: b8439304bfd4767955a9c8d59df61443708c21de Parents: 75d43f7 Author: Sneha Tilak <[email protected]> Authored: Fri Jun 30 14:57:01 2017 -0400 Committer: Sneha Tilak <[email protected]> Committed: Fri Jun 30 14:57:01 2017 -0400 ---------------------------------------------------------------------- .../GatewayRequestUpdateController.php | 70 ++++++++++++++++++++ app/controllers/UpdateController.php | 70 -------------------- app/routes.php | 4 +- 3 files changed, 72 insertions(+), 72 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b8439304/app/controllers/GatewayRequestUpdateController.php ---------------------------------------------------------------------- diff --git a/app/controllers/GatewayRequestUpdateController.php b/app/controllers/GatewayRequestUpdateController.php new file mode 100644 index 0000000..e67d40d --- /dev/null +++ b/app/controllers/GatewayRequestUpdateController.php @@ -0,0 +1,70 @@ +<?php + +class GatewayRequestUpdateController extends BaseController +{ + + public function updateGatewayRequest(){ + + $gateway = AdminUtilities::update_form( Input::get("gateway-id"), Input::all() ); + + $gatewayData = array ("gatewayId" => $gateway->gatewayId, + "gatewayName" => $gateway->gatewayName, + "emailAddress" => $gateway->emailAddress, + "publicProjectDescription" => $gateway->gatewayPublicAbstract, + "gatewayURL" => $gateway->gatewayURL, + "adminFirstName" => $gateway->gatewayAdminFirstName, + "adminLastName" => $gateway-> gatewayAdminLastName, + "adminUsername" => $gateway->identityServerUserName, + "adminEmail" => $gateway->gatewayAdminEmail, + "projectDetails" => $gateway->reviewProposalDescription); + + return View::make("account/update")->with(array('gatewayData'=>$gatewayData)); + + } + + public function updateDetails(){ + + $inputs = Input::all(); + $rules = array( + "username" => "required|min:6", + "password" => "required|min:6|max:48|regex:/^.*(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@!$#*]).*$/", + "confirm_password" => "required|same:password", + "email" => "required|email", + ); + + $messages = array( + 'password.regex' => 'Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$&*', + ); + + $checkValidation = array(); + $checkValidation["username"] = $inputs["admin-username"]; + $checkValidation["password"] = $inputs["admin-password"]; + $checkValidation["confirm_password"] = $inputs["admin-password-confirm"]; + $checkValidation["email"] = $inputs["admin-email"]; + + $validator = Validator::make( $checkValidation, $rules, $messages); + if ($validator->fails()) { + Session::put("validationMessages", $validator->messages() ); + return Redirect::back() + ->withInput(Input::except('password', 'password_confirm')) + ->withErrors($validator); + } + else { + $returnVal = AdminUtilities::user_update_gateway(Input::get("gateway-id"), Input::all()); + + if ($returnVal == 1) { + $username = Session::get("username"); + $email = Config::get('pga_config.portal')['admin-emails']; + $user_profile = Keycloak::getUserProfile($username); + EmailUtilities::mailToUser($user_profile["firstname"], $user_profile["lastname"], $email, Input::get("gateway-id")); + EmailUtilities::mailToAdmin($email, Input::get("gateway-id")); + Session::put("message", "Your Gateway has been updated"); + } else + Session::put("errorMessages", "Error: Please try again or contact admin to report the issue."); + } + + return Redirect::to("admin/dashboard"); + + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b8439304/app/controllers/UpdateController.php ---------------------------------------------------------------------- diff --git a/app/controllers/UpdateController.php b/app/controllers/UpdateController.php deleted file mode 100644 index 48044f4..0000000 --- a/app/controllers/UpdateController.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -class UpdateController extends BaseController -{ - - public function updateGatewayRequest(){ - - $gateway = AdminUtilities::update_form( Input::get("gateway-id"), Input::all() ); - - $gatewayData = array ("gatewayId" => $gateway->gatewayId, - "gatewayName" => $gateway->gatewayName, - "emailAddress" => $gateway->emailAddress, - "publicProjectDescription" => $gateway->gatewayPublicAbstract, - "gatewayURL" => $gateway->gatewayURL, - "adminFirstName" => $gateway->gatewayAdminFirstName, - "adminLastName" => $gateway-> gatewayAdminLastName, - "adminUsername" => $gateway->identityServerUserName, - "adminEmail" => $gateway->gatewayAdminEmail, - "projectDetails" => $gateway->reviewProposalDescription); - - return View::make("account/update")->with(array('gatewayData'=>$gatewayData)); - - } - - public function updateDetails(){ - - $inputs = Input::all(); - $rules = array( - "username" => "required|min:6", - "password" => "required|min:6|max:48|regex:/^.*(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@!$#*]).*$/", - "confirm_password" => "required|same:password", - "email" => "required|email", - ); - - $messages = array( - 'password.regex' => 'Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$&*', - ); - - $checkValidation = array(); - $checkValidation["username"] = $inputs["admin-username"]; - $checkValidation["password"] = $inputs["admin-password"]; - $checkValidation["confirm_password"] = $inputs["admin-password-confirm"]; - $checkValidation["email"] = $inputs["admin-email"]; - - $validator = Validator::make( $checkValidation, $rules, $messages); - if ($validator->fails()) { - Session::put("validationMessages", $validator->messages() ); - return Redirect::back() - ->withInput(Input::except('password', 'password_confirm')) - ->withErrors($validator); - } - else { - $returnVal = AdminUtilities::user_update_gateway(Input::get("gateway-id"), Input::all()); - - if ($returnVal == 1) { - $username = Session::get("username"); - $email = Config::get('pga_config.portal')['admin-emails']; - $user_profile = Keycloak::getUserProfile($username); - EmailUtilities::mailToUser($user_profile["firstname"], $user_profile["lastname"], $email, Input::get("gateway-id")); - EmailUtilities::mailToAdmin($email, Input::get("gateway-id")); - Session::put("message", "Your Gateway has been updated"); - } else - Session::put("errorMessages", "Error: Please try again or contact admin to report the issue."); - } - - return Redirect::to("admin/dashboard"); - - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b8439304/app/routes.php ---------------------------------------------------------------------- diff --git a/app/routes.php b/app/routes.php index c0a881f..1f93efb 100755 --- a/app/routes.php +++ b/app/routes.php @@ -28,7 +28,7 @@ Route::get("refreshed-token-desktop", "AccountController@getRefreshedTokenForDes Route::get("account/dashboard", "AccountController@dashboard"); -Route::get("account/update-gateway", "UpdateController@updateGatewayRequest"); +Route::get("account/update-gateway", "GatewayRequestUpdateController@updateGatewayRequest"); Route::get("callback-url", "AccountController@oauthCallback"); @@ -362,7 +362,7 @@ Route::post("admin/remove-pwd-token", "AdminController@removePWD"); //GatewayProviders Route::get("provider/request-gateway", "AdminController@checkRequest"); Route::get("provider/add-gateway", "AdminController@requestGateway"); -Route::get("provider/update-details", "UpdateController@updateDetails"); +Route::get("provider/update-details", "GatewayRequestUpdateController@updateDetails"); //notices Route::get("admin/dashboard/notices", "AdminController@noticesView");
