You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2016/10/28 16:46:01 UTC

[12/20] airavata-php-gateway git commit: AIRAVATA-2156 New SSH key description is required server-side

AIRAVATA-2156 New SSH key description is required server-side


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/7c14035f
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/7c14035f
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/7c14035f

Branch: refs/heads/develop
Commit: 7c14035fed5879d86e87afbaea51e36a619602c0
Parents: 11dcac8
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Oct 27 09:17:14 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Oct 27 09:17:14 2016 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php        | 14 ++++++++++++++
 app/views/account/credential-store.blade.php |  5 +++++
 2 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7c14035f/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 615fe73..bd8091d 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -496,6 +496,20 @@ class AccountController extends BaseController
 
     public function addCredential() {
 
+        $rules = array(
+            "credential-description" => "required",
+        );
+
+        $messages = array(
+            "credential-description.required" => "A description is required for a new SSH key",
+        );
+
+        $validator = Validator::make(Input::all(), $rules, $messages);
+        if ($validator->fails()) {
+            return Redirect::to("account/credential-store")
+                ->withErrors($validator);
+        }
+
         $description = Input::get("credential-description");
 
         if (AdminUtilities::create_ssh_token_with_description($description)) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7c14035f/app/views/account/credential-store.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/credential-store.blade.php b/app/views/account/credential-store.blade.php
index 690e47a..9c9bca3 100644
--- a/app/views/account/credential-store.blade.php
+++ b/app/views/account/credential-store.blade.php
@@ -33,6 +33,11 @@
     </form>
 
     <h3>Add SSH Key</h3>
+    @if ($errors->has())
+    @foreach ($errors->all() as $error)
+    {{ CommonUtilities::print_error_message($error) }}
+    @endforeach
+    @endif
     <form class="form-inline" action="{{ URL::to('/') }}/account/add-credential" method="post">
         <div class="form-group">
             <label for="defaultToken" class="sr-only">Description for new SSH key</label>