Merge branch 'AIRAVATA-2502'
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 @@
$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 @@
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 @@
$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 @@
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 @@
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..c86e223 100644
--- a/app/views/account/create.blade.php
+++ b/app/views/account/create.blade.php
@@ -6,8 +6,25 @@
@section('content')
+@if (!empty($auth_code_options))
+ <div class="col-md-offset-1 col-md-4 center-column">
+ <div class="page-header">
+ <h3>Log in with your existing organizational login</h3>
+ </div>
+ @foreach ($auth_code_options as $auth_code_option)
+ @include('partials/login-external', array("auth_code_option" => $auth_code_option))
+ @endforeach
+ </div>
+ <div class="col-md-2 center-column">
+ <h3 id="login-option-separator" class="horizontal-rule">OR</h3>
+ </div>
+@endif
+
+@if (!empty($auth_code_options))
+<div class="col-md-4 center-column">
+@else
<div class="col-md-offset-4 col-md-4">
- @if (!empty($auth_password_option))
+@endif
<div class="page-header">
<h3>Create New {{{ $auth_password_option["name"] }}} Account
<small>
@@ -73,15 +90,6 @@
<input name="Submit" type="submit" class="btn btn-primary btn-block" value="Create">
</form>
- @if (!empty($auth_code_options))
- <h3 id="login-option-separator" class="horizontal-rule">OR</h4>
- @endif
- @endif {{-- @if (!empty($auth_password_option)) --}}
-
- @if (!empty($auth_code_options))
- @include('partials/login-external', array("auth_code_options" => $auth_code_options))
- @endif
-
<style media="screen" type="text/css">
.form-group.required .control-label:after {
content: " *";
diff --git a/app/views/account/login-desktop.blade.php b/app/views/account/login-desktop.blade.php
index 2108206..646f821 100755
--- a/app/views/account/login-desktop.blade.php
+++ b/app/views/account/login-desktop.blade.php
@@ -6,16 +6,34 @@
@section('content')
-<div class="col-md-offset-4 col-md-4">
- @if (!empty($auth_password_option))
- @include('partials/login-form', array("auth_name" => $auth_password_option["name"], "desktop" => true))
- @if (!empty($auth_code_options))
- <h3 id="login-option-separator" class="horizontal-rule">OR</h4>
- @endif
+@if(count($auth_code_options) > 0)
+ @if($has_auth_code_and_password_options)
+ <div class="col-md-offset-1 col-md-4 center-column">
+ @else
+ <div class="col-md-offset-4 col-md-4 center-column">
@endif
- @if (!empty($auth_code_options))
- @include('partials/login-external', array("auth_code_options" => $auth_code_options))
+
+ @foreach ($auth_code_options as $auth_code_option)
+ @include('partials/login-external', array("auth_code_option" => $auth_code_option))
+ @endforeach
+ </div>
+@endif
+
+@if($has_auth_code_and_password_options)
+ <div class="col-md-2 center-column">
+ <h3 id="login-option-separator" class="horizontal-rule">OR</h3>
+ </div>
+@endif
+
+@if(!empty($auth_password_option))
+ @if($has_auth_code_and_password_options)
+ <div class="col-md-4 center-column">
+ @else
+ <div class="col-md-offset-4 col-md-4 center-column">
@endif
-</div>
+
+ @include('partials/login-form', array("auth_name" => $auth_password_option["name"], "desktop" => true))
+ </div>
+@endif
@stop
\ No newline at end of file
diff --git a/app/views/account/login.blade.php b/app/views/account/login.blade.php
index 1e8a52a..dcd5f54 100755
--- a/app/views/account/login.blade.php
+++ b/app/views/account/login.blade.php
@@ -6,17 +6,37 @@
@section('content')
-<div class="col-md-offset-4 col-md-4">
+@if(count($auth_code_options) > 0)
+ @if($has_auth_code_and_password_options)
+ <div class="col-md-offset-1 col-md-4 center-column">
+ @else
+ <div class="col-md-offset-4 col-md-4 center-column">
+ @endif
- @if (!empty($auth_password_option))
- @include('partials/login-form', array("auth_name" => $auth_password_option["name"]))
- @if (!empty($auth_code_options))
- <h3 id="login-option-separator" class="horizontal-rule">OR</h4>
- @endif
+ <div class="page-header">
+ <h3>Log in with your existing organizational login</h3>
+ </div>
+ @foreach ($auth_code_options as $auth_code_option)
+ @include('partials/login-external', array("auth_code_option" => $auth_code_option))
+ @endforeach
+ </div>
+@endif
+
+@if($has_auth_code_and_password_options)
+ <div class="col-md-2 center-column">
+ <h3 id="login-option-separator" class="horizontal-rule">OR</h3>
+ </div>
+@endif
+
+@if(!empty($auth_password_option))
+ @if($has_auth_code_and_password_options)
+ <div class="col-md-4 center-column">
+ @else
+ <div class="col-md-offset-4 col-md-4 center-column">
@endif
- @if (!empty($auth_code_options))
- @include('partials/login-external', array("auth_code_options" => $auth_code_options))
- @endif
-</div>
+
+ @include('partials/login-form', array("auth_name" => $auth_password_option["name"]))
+ </div>
+@endif
@stop
\ No newline at end of file
diff --git a/app/views/partials/login-external.blade.php b/app/views/partials/login-external.blade.php
index 393048a..82ecb1a 100644
--- a/app/views/partials/login-external.blade.php
+++ b/app/views/partials/login-external.blade.php
@@ -1,9 +1,7 @@
-@foreach ($auth_code_options as $auth_code_option)
- <a href="{{ $auth_code_option["auth_url"] }}" class="btn btn-primary btn-block">
- @if (isset($auth_code_option["logo"]))
- <img src="{{ $auth_code_option["logo"] }}">
- @endif
- Sign in with {{{ $auth_code_option["name"] }}}
- </a>
-@endforeach
+<a href="{{ $auth_code_option["auth_url"] }}" class="btn btn-primary btn-block btn-external-login">
+ @if (isset($auth_code_option["logo"]))
+ <img src="{{ $auth_code_option["logo"] }}">
+ @endif
+ Sign in with {{{ $auth_code_option["name"] }}}
+</a>
diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css
index cae0f80..2f479ad 100644
--- a/public/css/bootstrap.min.css
+++ b/public/css/bootstrap.min.css
@@ -193,3 +193,30 @@
left: 0.5em;
margin-right: -50%;
}
+
+/* vertically center a Bootstrap column. Must be applied to every column in the row. */
+.center-column {
+ display: inline-block;
+ vertical-align: middle;
+ float: none;
+ width: 100%;
+}
+
+.btn-external-login + .btn-external-login {
+ margin-top: 40px;
+}
+
+@media (min-width: 992px) {
+ .center-column.col-md-12 { width:100% }
+ .center-column.col-md-11 { width:91.66666667% }
+ .center-column.col-md-10 { width:83.33333333% }
+ .center-column.col-md-9 { width:75% }
+ .center-column.col-md-8 { width:66.66666667% }
+ .center-column.col-md-7 { width:58.33333333% }
+ .center-column.col-md-6 { width:50% }
+ .center-column.col-md-5 { width:41.66666667% }
+ .center-column.col-md-4 { width:33.33333333% }
+ .center-column.col-md-3 { width:25% }
+ .center-column.col-md-2 { width:16.66666667% }
+ .center-column.col-md-1 { width:8.33333333% }
+}