Fix on Email Verification
* Now users only could be logged in only if they verified they email addresss * added link on login page to resend email verification * fixed some styles to be more mobile friendly Change-Id: I55afd401ff69404414c95dc267e9fbdf4fe26a70
This commit is contained in:
parent
6bf8de3d3e
commit
0e93b131a0
|
@ -19,11 +19,11 @@ use utils\services\IAuthService;
|
|||
use utils\services\IServerConfigurationService as IUtilsServerConfigurationService;
|
||||
use oauth2\services\IMementoOAuth2SerializerService;
|
||||
use oauth2\services\ISecurityContextService;
|
||||
|
||||
use auth\exceptions\AuthenticationException;
|
||||
/**
|
||||
* Class UserController
|
||||
*/
|
||||
class UserController extends OpenIdController
|
||||
final class UserController extends OpenIdController
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -226,8 +226,10 @@ class UserController extends OpenIdController
|
|||
{
|
||||
return $this->login_strategy->postLogin();
|
||||
}
|
||||
|
||||
//failed login attempt...
|
||||
$user = $this->auth_service->getUserByUsername($username);
|
||||
|
||||
if ($user)
|
||||
{
|
||||
$login_attempts = $user->login_failed_attempt;
|
||||
|
@ -240,7 +242,7 @@ class UserController extends OpenIdController
|
|||
'max_login_attempts_2_show_captcha' => $max_login_attempts_2_show_captcha,
|
||||
'login_attempts' => $login_attempts,
|
||||
'username' => $username,
|
||||
'error_message' => "We\'re sorry, your username or password does not match an existing record."
|
||||
'error_message' => "We are sorry, your username or password does not match an existing record."
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -255,6 +257,10 @@ class UserController extends OpenIdController
|
|||
)
|
||||
);
|
||||
}
|
||||
catch(AuthenticationException $ex1){
|
||||
Log::warning($ex1);
|
||||
return Redirect::action('UserController@getLogin');
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
Log::error($ex);
|
|
@ -149,6 +149,8 @@ class CustomAuthProvider implements UserProviderInterface
|
|||
|
||||
if(!$member->canLogin())
|
||||
{
|
||||
if(!$member->isEmailVerified())
|
||||
throw new AuthenticationException(sprintf("member %s is not verified yet!", $email));
|
||||
throw new AuthenticationException(sprintf("member %s does not exists!", $email));
|
||||
}
|
||||
|
||||
|
@ -160,7 +162,6 @@ class CustomAuthProvider implements UserProviderInterface
|
|||
sprintf("invalid login attempt for user %s ", $email));
|
||||
}
|
||||
|
||||
|
||||
$user = $user_repository->getByExternalId($member->ID);
|
||||
|
||||
if (!$user) {
|
||||
|
|
|
@ -35,12 +35,16 @@ class Member extends BaseModelEloquent
|
|||
*/
|
||||
public function canLogin()
|
||||
{
|
||||
return $this->isEmailVerified() && $this->isActive();
|
||||
}
|
||||
|
||||
public function isActive(){
|
||||
$attr = $this->getAttributes();
|
||||
if(isset($attr['Active']))
|
||||
{
|
||||
return (bool)$attr['Active'];
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,10 +12,20 @@
|
|||
<h1>OpenStackId Identity Provider</h1>
|
||||
<div class="panel">
|
||||
<div class="panel-heading strong">Log in to OpenStack</div>
|
||||
<div style="text-align: center">
|
||||
<a href="{{ URL::action("UserController@getLogin")}}" class="btn btn-default btn-md active">Sign in to your account</a>
|
||||
<a href="{{ ServerConfigurationService::getConfigValue("Assets.Url") }}join/register"
|
||||
class="btn btn-default btn-md active">Register for an OpenStack ID</a>
|
||||
<div class="row" style="text-align: center;">
|
||||
<div class="col-md-12">
|
||||
<div class="row" style="padding-top: 5px;padding-bottom: 5px;">
|
||||
<div class="col-md-12">
|
||||
<a href="{{ URL::action("UserController@getLogin")}}" class="btn btn-default btn-md active">Sign in to your account</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding-top: 5px;padding-bottom: 5px;">
|
||||
<div class="col-md-12">
|
||||
<a href="{{ ServerConfigurationService::getConfigValue("Assets.Url") }}join/register"
|
||||
class="btn btn-default btn-md active">Register for an OpenStack ID</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-info margin-top-20">Once you're signed in, you can manage your trusted sites, change
|
||||
your settings and more.</p>
|
||||
|
|
|
@ -31,9 +31,17 @@
|
|||
@endif
|
||||
@endif
|
||||
@else
|
||||
Welcome, {{{ $username }}}.
|
||||
<a class="btn btn-default btn-sm active" href="{{ URL::action("UserController@getProfile") }}"">edit your profile</a>
|
||||
<a class="btn btn-default btn-sm active" href="{{ URL::action("UserController@logout") }}"">logout</a>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
Welcome, {{{ $username }}}.
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<a class="btn btn-default btn-sm active" href="{{ URL::action('UserController@getProfile') }}">edit your profile</a>
|
||||
<a class="btn btn-default btn-sm active" href="{{ URL::action('UserController@logout') }}">logout</a>
|
||||
</div>
|
||||
</div>
|
||||
@if( $show_fullname === 0 && $show_email===0 && $show_pic === 0)
|
||||
<p>
|
||||
This is your identity page. You are currently displaying no information on this page. You can display information such as your name, contact info and a photo.
|
||||
|
|
|
@ -7,17 +7,15 @@
|
|||
@append
|
||||
@section('content')
|
||||
|
||||
<h4>Please use your OpenStack ID to log in</h4>
|
||||
<h4 style="margin-left: 15px;">Please use your OpenStack ID to log in</h4>
|
||||
@if(isset($identity_select))
|
||||
<legend style="margin-left: 15px;">
|
||||
@if(!$identity_select)
|
||||
<legend>
|
||||
Sign in to <b>{{$realm}}</b> using <b>{{$identity}}</b>
|
||||
</legend>
|
||||
Sign in to <b>{{$realm}}</b> using <b>{{$identity}}</b>
|
||||
@else
|
||||
<legend>
|
||||
Sign in to <b>{{$realm}}</b> using your openstackid
|
||||
</legend>
|
||||
Sign in to <b>{{$realm}}</b> using your OpenStackID
|
||||
@endif
|
||||
</legend>
|
||||
@endif
|
||||
|
||||
<div class="col-md-4" id="sidebar">
|
||||
|
@ -54,17 +52,26 @@
|
|||
<a class="btn btn-primary" href="{{ URL::action('UserController@cancelLogin') }}">Cancel</a>
|
||||
</div>
|
||||
<div style="clear:both;padding-top:15px;" class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12">
|
||||
<a title="forgot password"
|
||||
href="{{ ServerConfigurationService::getConfigValue("Assets.Url") }}Security/lostpassword">Forgot
|
||||
password?</a>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<a title="register new account"
|
||||
href="{{ ServerConfigurationService::getConfigValue("Assets.Url") }}join/register">Register
|
||||
for an OpenStack ID</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style="clear:both;padding-top:15px;" class="row">
|
||||
<div class="col-md-12">
|
||||
<a title="register new account"
|
||||
href="{{ ServerConfigurationService::getConfigValue("Assets.Url") }}join/register">Register
|
||||
for an OpenStack ID</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear:both;padding-top:15px;" class="row">
|
||||
<div class="col-md-12">
|
||||
<a title="verify account"
|
||||
href="{{ ServerConfigurationService::getConfigValue("Assets.Url") }}members/verification/resend">Verify OpenStack ID</a>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="container-fluid">
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<nav class="navbar navbar-default navbar-static-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#"></a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul id='main-menu' class="nav navbar-nav">
|
||||
<li id="profile"><a href='{{ URL::action("UserController@getProfile") }}'>Settings</a></li>
|
||||
@if( ServerConfigurationService::getConfigValue("OAuth2.Enable") == true)
|
||||
|
@ -44,6 +53,6 @@
|
|||
@endif
|
||||
<li><a href='{{ URL::action("UserController@logout") }}'>Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
|
@ -12,12 +12,11 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12 col-xs-10">
|
||||
Hello, {{{ $username }}}.
|
||||
<div>Your OPENID: <a href="{{ str_replace("%23","#",$openid_url) }}">{{ str_replace("%23","#",$openid_url) }}</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ Form::open(array('url' => URL::action('UserController@postUserProfileOptions'), 'method' => 'post')) }}
|
||||
|
@ -44,10 +43,9 @@
|
|||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (count($sites)>0)
|
||||
<div class="row">
|
||||
<div id="trusted_sites" class="col-md-12">
|
||||
<div id="trusted_sites" class="col-md-12 col-xs-12">
|
||||
<legend><span class="glyphicon glyphicon-info-sign pointable" aria-hidden="true" title="Users can keep track of their trusted sites and manage them"></span> Trusted Sites</legend>
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
|
@ -65,10 +63,10 @@
|
|||
@else
|
||||
<tr class="error">
|
||||
@endif
|
||||
<td>{{ $site->getRealm() }}</td>
|
||||
<td>{{ $site->getAuthorizationPolicy()}}</td>
|
||||
<td>{{ $site->getUITrustedData() }}</td>
|
||||
<td>{{ HTML::link(URL::action("UserController@deleteTrustedSite",array("id"=>$site->id)),'Delete',array('class'=>'btn btn-default btn-md active btn-delete del-realm','title'=>'Deletes a decision about a particular trusted site,')) }}</td>
|
||||
<td width="50%">{{ $site->getRealm() }}</td>
|
||||
<td width="10%">{{ $site->getAuthorizationPolicy()}}</td>
|
||||
<td width="20%">{{ $site->getUITrustedData() }}</td>
|
||||
<td width="10%">{{ HTML::link(URL::action("UserController@deleteTrustedSite",array("id"=>$site->id)),'Delete',array('class'=>'btn btn-default btn-md active btn-delete del-realm','title'=>'Deletes a decision about a particular trusted site,')) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
@ -79,7 +77,7 @@
|
|||
|
||||
@if (count($actions)>0)
|
||||
<div class="row">
|
||||
<div id="actions" class="col-md-12">
|
||||
<div id="actions" class="col-md-12 col-xs-12">
|
||||
<legend><span class="glyphicon glyphicon-info-sign pointable" aria-hidden="true" title="Users actions"></span> User Actions</legend>
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
|
|
Loading…
Reference in New Issue