Repository: airavata-php-gateway Updated Branches: refs/heads/develop 74768948b -> 712cd2fe5
adding login desktop view 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/05c10526 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/05c10526 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/05c10526 Branch: refs/heads/develop Commit: 05c105266fc088a41bd88bd5b22f0bb849ca6b1d Parents: 5a25574 Author: scnakandala <[email protected]> Authored: Wed Jun 28 13:40:31 2017 -0400 Committer: scnakandala <[email protected]> Committed: Wed Jun 28 13:40:31 2017 -0400 ---------------------------------------------------------------------- app/config/app.php | 2 +- app/controllers/AccountController.php | 37 ++++++--- app/routes.php | 2 + app/views/account/login-desktop.blade.php | 22 ++++++ app/views/layout/desktop-login.blade.php | 103 +++++++++++++++++++++++++ app/views/partials/login-form.blade.php | 12 ++- 6 files changed, 163 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/05c10526/app/config/app.php ---------------------------------------------------------------------- diff --git a/app/config/app.php b/app/config/app.php index f13aa23..14d95de 100755 --- a/app/config/app.php +++ b/app/config/app.php @@ -13,7 +13,7 @@ return array( | */ - 'debug' => false, + 'debug' => true, /* |-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/05c10526/app/controllers/AccountController.php ---------------------------------------------------------------------- diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index edadcf7..dde4682 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -92,19 +92,37 @@ class AccountController extends BaseController } } + public function loginDesktopView() + { + // Only support for one password option + $auth_password_option = CommonUtilities::getAuthPasswordOption(); + // Support for many external identity providers (authorization code auth flow) + $auth_code_options = CommonUtilities::getAuthCodeOptions(); + + // If no username/password option and only one external identity + // provider, just redirect immediately + if ($auth_password_option == null && count($auth_code_options)) { + return Redirect::away($auth_code_options[0]["auth_url"]); + } else { + return View::make('account/login-desktop', array( + "auth_password_option" => $auth_password_option, + "auth_code_options" => $auth_code_options, + )); + } + } + public function loginSubmit() { if (CommonUtilities::form_submitted()) { - $wsisConfig = Config::get('pga_config.wsis'); $username = Input::get("username"); $password = $_POST['password']; $response = Keycloak::authenticate($username, $password); if(!isset($response->access_token)){ if (Keycloak::isUpdatePasswordRequired($username)) { - return Redirect::to("login")->with("update-password-required", true); + return Redirect::to("login?status=failed")->with("update-password-required", true); } else { - return Redirect::to("login")->with("invalid-credentials", true); + return Redirect::to("login?status=failed")->with("invalid-credentials", true); } } @@ -155,11 +173,11 @@ class AccountController extends BaseController return $this->initializeWithAiravata($username, $userEmail, $firstName, $lastName); } + $status = '?status=ok&code=' . $accessToken; if(Session::has("admin") || Session::has("admin-read-only")){ - - return Redirect::to("admin/dashboard"); + return Redirect::to("admin/dashboard" . $status); }else{ - return Redirect::to("account/dashboard"); + return Redirect::to("account/dashboard" . $status); } } @@ -227,11 +245,11 @@ class AccountController extends BaseController return $this->initializeWithAiravata($username, $userEmail, $firstName, $lastName); } + $status = '?status=ok&code=' . $accessToken; if(Session::has("admin") || Session::has("admin-read-only")){ - - return Redirect::to("admin/dashboard"); + return Redirect::to("admin/dashboard" . $status); }else{ - return Redirect::to("account/dashboard"); + return Redirect::to("account/dashboard" . $status); } } @@ -473,7 +491,6 @@ class AccountController extends BaseController } } - public function logout() { Session::flush(); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/05c10526/app/routes.php ---------------------------------------------------------------------- diff --git a/app/routes.php b/app/routes.php index 61dab84..2c142f3 100755 --- a/app/routes.php +++ b/app/routes.php @@ -22,6 +22,8 @@ Route::get("login", "AccountController@loginView"); Route::post("login", "AccountController@loginSubmit"); +Route::get("login-desktop", "AccountController@loginDesktopView"); + Route::get("account/dashboard", "AccountController@dashboard"); Route::get("callback-url", "AccountController@oauthCallback"); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/05c10526/app/views/account/login-desktop.blade.php ---------------------------------------------------------------------- diff --git a/app/views/account/login-desktop.blade.php b/app/views/account/login-desktop.blade.php new file mode 100755 index 0000000..62abe15 --- /dev/null +++ b/app/views/account/login-desktop.blade.php @@ -0,0 +1,22 @@ +@extends('layout.desktop-login') + +@section('page-header') +@parent +@stop + +@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 + @endif + @if (!empty($auth_code_options)) + @include('partials/login-external', array("auth_code_options" => $auth_code_options)) + @endif +</div> + +@stop \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/05c10526/app/views/layout/desktop-login.blade.php ---------------------------------------------------------------------- diff --git a/app/views/layout/desktop-login.blade.php b/app/views/layout/desktop-login.blade.php new file mode 100755 index 0000000..ee76766 --- /dev/null +++ b/app/views/layout/desktop-login.blade.php @@ -0,0 +1,103 @@ +<?php +$theme = Theme::uses(Session::get("theme")); +$title = Session::get("portal-title"); +?> + +@section ('page-header') +@include("layout/fixed-header", array( + "title" => $title + )) +@show +<style> +/*z index of sidebar is 100.*/ +.theme-header{ + position: relative; + z-index:101; +} +.content-area{ + margin: 20px 0 !important; +} +</style> + +<body> + +<!-- PGA UI lies here. Do not touch. --> +<style> +.content-area{ + margin:0; +} +</style> +<div class="row content-area"> + @yield('content') +</div> + +@show + +@section('scripts') +@include('layout/fixed-scripts') +{{ HTML::script('js/time-conversion.js')}} +<script type="text/javascript"> + /* keeping a check that footer stays atleast at the bottom of the window.*/ + var bh = $("html").height(); + if( bh < $(window).height()){ + $(".theme-footer").css("position", "relative").css("top", $(window).height()/4).css("z-index", "-1"); + } + var bw = $("body").width(); + if( bw > 767){ + $(".hero-unit").height( bw*0.36); + } + + //put sidebar below all headers in admin dashboards + if( $(".side-nav").length > 0){ + var headerHeight = $(".pga-header").height() + $(".theme-header").height(); + $(".side-nav").css("top", headerHeight); + $(".side-nav").affix(); + var selectedDashboardHeight = $(window).height() - headerHeight; + + if( selectedDashboardHeight < $(".side-nav").height()) + { + $(".side-nav").height( selectedDashboardHeight); + } + } + + $(".floating").click( function(){ + $('html,body').animate({ + scrollTop: $(".seagrid-info").offset().top}, + 'slow'); + $(".seagrid-info").scrollTop( $(window).scrollTop() + 150); + }) + + $(".notif-link").click( function(){ + $.ajax({ + type:"post", + url:"{{URL::to('/')}}/notice-seen-ack", + data:{"notice-count": $(".notif-num").data("total-notices")} + }); + $(".notif-num").addClass("fade"); + }) +</script> + +<!-- Google Analytics for portal--> + +@if( isset( Config::get('pga_config.portal')['google-analytics-id'])) + + @if( Config::get("pga_config.portal")["google-analytics-id"] != '') + <script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', '{{ Config::get("pga_config.portal")["google-analytics-id"] }}', 'auto'); + ga('send', 'pageview'); + + </script> + @endif + +@endif +<!-- end google analytics --> +@show + +</body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/05c10526/app/views/partials/login-form.blade.php ---------------------------------------------------------------------- diff --git a/app/views/partials/login-form.blade.php b/app/views/partials/login-form.blade.php index 304ffad..5c45f4d 100644 --- a/app/views/partials/login-form.blade.php +++ b/app/views/partials/login-form.blade.php @@ -1,9 +1,11 @@ <h3> Login with {{{ $auth_name }}} - <small> - <small> (Not registered? <a href="create">Create account</a>)</small> - </small> + @if (!isset($desktop)) + <small> + <small> (Not registered? <a href="create">Create account</a>)</small> + </small> + @endif </h3> @@ -39,5 +41,7 @@ </form> <small> - <small> (Forgot Password? Click <a href="{{URL::to('/') }}/forgot-password">here</a>)</small> + @if (!isset($desktop)) + <small> (Forgot Password? Click <a href="{{URL::to('/') }}/forgot-password">here</a>)</small> + @endif </small>
