Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6317E200D34 for ; Fri, 3 Nov 2017 16:59:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 61A73160BFB; Fri, 3 Nov 2017 15:59:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7FB4A160BE9 for ; Fri, 3 Nov 2017 16:59:04 +0100 (CET) Received: (qmail 65045 invoked by uid 500); 3 Nov 2017 15:59:03 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 65036 invoked by uid 99); 3 Nov 2017 15:59:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2017 15:59:03 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 51A0F81B45; Fri, 3 Nov 2017 15:59:00 +0000 (UTC) Date: Fri, 03 Nov 2017 15:59:00 +0000 To: "commits@airavata.apache.org" Subject: [airavata-php-gateway] 01/02: AIRAVATA-2502 External logins listed first (on the left) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: machristie@apache.org In-Reply-To: <150972473995.30489.5102793372351791175@gitbox.apache.org> References: <150972473995.30489.5102793372351791175@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: airavata-php-gateway X-Git-Refname: refs/heads/develop X-Git-Reftype: branch X-Git-Rev: fd6675b85ea6f193b476c85b65c43330c52a3b25 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20171103155901.51A0F81B45@gitbox.apache.org> archived-at: Fri, 03 Nov 2017 15:59:05 -0000 This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git commit fd6675b85ea6f193b476c85b65c43330c52a3b25 Author: Marcus Christie AuthorDate: Fri Nov 3 11:56:31 2017 -0400 AIRAVATA-2502 External logins listed first (on the left) --- app/controllers/AccountController.php | 4 ++++ app/libraries/CommonUtilities.php | 12 ++++++---- app/views/account/create.blade.php | 25 +++++++++++-------- app/views/account/login-desktop.blade.php | 36 +++++++++++++++++++++------- app/views/account/login.blade.php | 37 +++++++++++++++++++++-------- app/views/partials/login-external.blade.php | 14 +++++------ public/css/bootstrap.min.css | 28 ++++++++++++++++++++++ 7 files changed, 115 insertions(+), 41 deletions(-) diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index f9ea073..083bff0 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -79,6 +79,7 @@ class AccountController extends BaseController $auth_password_option = CommonUtilities::getAuthPasswordOption(); // Support for many external identity providers (authorization code auth flow) $auth_code_options = CommonUtilities::getAuthCodeOptions(); + $has_auth_code_and_password_options = $auth_password_option != null && count($auth_code_options) > 0; // If no username/password option and only one external identity // provider, just redirect immediately @@ -88,6 +89,7 @@ class AccountController extends BaseController return View::make('account/login', array( "auth_password_option" => $auth_password_option, "auth_code_options" => $auth_code_options, + "has_auth_code_and_password_options" => $has_auth_code_and_password_options, )); } } @@ -98,6 +100,7 @@ class AccountController extends BaseController $auth_password_option = CommonUtilities::getAuthPasswordOption(); // Support for many external identity providers (authorization code auth flow) $auth_code_options = CommonUtilities::getAuthCodeOptions(); + $has_auth_code_and_password_options = $auth_password_option != null && count($auth_code_options) > 0; // If no username/password option and only one external identity // provider, just redirect immediately @@ -107,6 +110,7 @@ class AccountController extends BaseController return View::make('account/login-desktop', array( "auth_password_option" => $auth_password_option, "auth_code_options" => $auth_code_options, + "has_auth_code_and_password_options" => $has_auth_code_and_password_options, )); } } diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php index 525ec40..877339b 100644 --- a/app/libraries/CommonUtilities.php +++ b/app/libraries/CommonUtilities.php @@ -468,10 +468,14 @@ class CommonUtilities public static function getAuthPasswordOption() { $auth_options = Config::get('pga_config.wsis')['auth-options']; - $auth_password_option_array = array_filter($auth_options, function($auth_option) { - return $auth_option["oauth-grant-type"] == "password"; - }); - return count($auth_password_option_array) > 0 ? $auth_password_option_array[0] : null; + $auth_password_option = null; + foreach ($auth_options as $key => $auth_option) { + if ($auth_option["oauth-grant-type"] == "password") { + $auth_password_option = $auth_option; + break; + } + } + return $auth_password_option; } public static function getAuthCodeOptions() { diff --git a/app/views/account/create.blade.php b/app/views/account/create.blade.php index c490761..ab6187f 100644 --- a/app/views/account/create.blade.php +++ b/app/views/account/create.blade.php @@ -6,8 +6,22 @@ @section('content') +@if (!empty($auth_code_options)) +
+ @foreach ($auth_code_options as $auth_code_option) + @include('partials/login-external', array("auth_code_option" => $auth_code_option)) + @endforeach +
+
+

OR

+
+@endif + +@if (!empty($auth_code_options)) +
+@else
- @if (!empty($auth_password_option)) +@endif