Bug-fix-patch-36

# Refined UI for showing error messages in new layout of
login/registration/create-ticket/home page while login and registration.
# fixed registration error when email is non mandatory field.
This commit is contained in:
Manish Verma
2016-12-05 00:44:08 +05:30
parent d9ac2c1405
commit a24cd1e62b
8 changed files with 99 additions and 86 deletions

View File

@@ -150,6 +150,7 @@ class AuthController extends Controller
*/ */
public function postRegister(User $user, RegisterRequest $request) public function postRegister(User $user, RegisterRequest $request)
{ {
try{
$request_array = $request->input(); $request_array = $request->input();
$password = Hash::make($request->input('password')); $password = Hash::make($request->input('password'));
$user->password = $password; $user->password = $password;
@@ -184,7 +185,9 @@ class AuthController extends Controller
$sms = Plugin::select('status')->where('name', '=', 'SMS')->first(); $sms = Plugin::select('status')->where('name', '=', 'SMS')->first();
// Event for login // Event for login
\Event::fire(new \App\Events\LoginEvent($request)); \Event::fire(new \App\Events\LoginEvent($request));
if ($request_array['email'] != '') {
$var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('account/activate/'.$code)]); $var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('account/activate/'.$code)]);
}
if ($settings->status == 1 || $settings->status == '1') { if ($settings->status == 1 || $settings->status == '1') {
if (count($sms) > 0) { if (count($sms) > 0) {
if ($sms->status == 1 || $sms->status == '1') { if ($sms->status == 1 || $sms->status == '1') {
@@ -198,8 +201,10 @@ class AuthController extends Controller
} else { } else {
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail'); $message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail');
} }
return redirect('home')->with('success', $message12); return redirect('home')->with('success', $message12);
} catch (\Exception $e) {
return redirect()->back()->with('fails', $e->getMessage());
}
} }
/** /**

View File

@@ -12,6 +12,7 @@ use App\User;
use Auth; use Auth;
use Exception; use Exception;
use Mail; use Mail;
use Lang;
class PhpMailController extends Controller class PhpMailController extends Controller
{ {
@@ -75,7 +76,7 @@ class PhpMailController extends Controller
{ {
$from_address = $this->fetch_smtp_details($from); $from_address = $this->fetch_smtp_details($from);
if ($from_address == null) { if ($from_address == null) {
throw new Exception('Invalid Email Configuration'); throw new Exception(Lang::get('lang.system-email-not-configured'));
} }
$this->setMailConfig($from_address); $this->setMailConfig($from_address);

View File

@@ -86,7 +86,7 @@ return [
'activate_your_account_click_on_Link_that_send_to_your_mail' => 'Activate your account! Click on the link that we\'ve sent to your mail', 'activate_your_account_click_on_Link_that_send_to_your_mail' => 'Activate your account! Click on the link that we\'ve sent to your mail',
'activate_your_account_click_on_Link_that_send_to_your_mail_and_moble' => 'Activate your account! Click on the link that we\'ve sent to your mail or login to your account and enter the OTP code we\'ve sent on your mobile number', 'activate_your_account_click_on_Link_that_send_to_your_mail_and_moble' => 'Activate your account! Click on the link that we\'ve sent to your mail or login to your account and enter the OTP code we\'ve sent on your mobile number',
'activate_your_account_click_on_Link_that_send_to_your_mail_sms_plugin_inactive_or_not_setup' => 'Account created, please contact to system admin as we were unable to send OTP code to your mobile and email to your email address.', 'activate_your_account_click_on_Link_that_send_to_your_mail_sms_plugin_inactive_or_not_setup' => 'Account created, please contact to system admin as we were unable to send OTP code to your mobile and email to your email address.',
'this_field_do_not_match_our_records' => ' does not match our records.', 'this_field_do_not_match_our_records' => ' This field does not match our records.',
'we_have_e-mailed_your_password_reset_link' => 'We have emailed your password reset link!', 'we_have_e-mailed_your_password_reset_link' => 'We have emailed your password reset link!',
"we_can't_find_a_user_with_that_e-mail_address" => "We can't find a user with that email address.", "we_can't_find_a_user_with_that_e-mail_address" => "We can't find a user with that email address.",
/* /*
@@ -1551,5 +1551,6 @@ return [
/*********** Updated 3-12-2016 **********/ /*********** Updated 3-12-2016 **********/
'activate' => 'Activate', 'activate' => 'Activate',
'system-email-not-configured' => 'We are unable to process email request as the system has no configured email for sending mails. Please contact and report system admin.',
]; ];

View File

@@ -13,13 +13,7 @@
<link href="{{asset("lb-faveo/css/jquerysctipttop.css")}}" rel="stylesheet" type="text/css"> <link href="{{asset("lb-faveo/css/jquerysctipttop.css")}}" rel="stylesheet" type="text/css">
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
@stop @stop
@if(Session::has('status'))
<div class="alert alert-success alert-dismissable">
<i class="fa fa-check-circle"> </i> <b> {!! Lang::get('lang.success') !!} </b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{Session::get('status')}}
</div>
@endif
<!-- @if (count($errors) > 0) <!-- @if (count($errors) > 0)
@@ -43,6 +37,24 @@
</div> </div>
@stop @stop
@section('content') @section('content')
@if(Session::has('status'))
<div class="alert alert-success alert-dismissable">
<i class="fa fa-check-circle"> </i> <b> {!! Lang::get('lang.success') !!} </b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{Session::get('status')}}
</div>
@endif
@if(Session::has('error'))
<div class="alert alert-danger alert-dismissable">
<i class="fa fa-check-circle"> </i> <b> {!! Lang::get('lang.alert') !!} </b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{Session::get('error')}}
</div>
@else
@if (count($errors) > 0) @if (count($errors) > 0)
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i> <i class="fa fa-ban"></i>
@@ -53,6 +65,8 @@
@endforeach @endforeach
</div> </div>
@endif @endif
@endif
<div id="content" class="site-content col-md-12"> <div id="content" class="site-content col-md-12">
<div id="corewidgetbox"> <div id="corewidgetbox">
<div class="widgetrow text-center"> <div class="widgetrow text-center">
@@ -115,7 +129,6 @@
<div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}"> <div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::text('email',null,['placeholder'=> Lang::get("lang.email") ,'class' => 'form-control']) !!} {!! Form::text('email',null,['placeholder'=> Lang::get("lang.email") ,'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
</div> </div>
</div> </div>
@@ -126,7 +139,6 @@
{!! Form::password('password',['placeholder'=>Lang::get("lang.password"),'class' => 'form-control']) !!} {!! Form::password('password',['placeholder'=>Lang::get("lang.password"),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-lock form-control-feedback"></span> <span class="glyphicon glyphicon-lock form-control-feedback"></span>
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
</div> </div>
</div> </div>

View File

@@ -14,26 +14,6 @@
<link href="{{asset("lb-faveo/css/jquerysctipttop.css")}}" rel="stylesheet" type="text/css"> <link href="{{asset("lb-faveo/css/jquerysctipttop.css")}}" rel="stylesheet" type="text/css">
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
@stop @stop
@if(Session::has('status'))
<div class="alert alert-success alert-dismissable">
<i class="fa fa-check-circle"> </i> <b> {!! Lang::get('lang.success') !!} </b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{Session::get('status')}}
</div>
@endif
<!--
@if (count($errors) > 0)
<div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i>
<b>{!! Lang::get('lang.alert') !!} !</b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</div>
@endif -->
@section('breadcrumb') @section('breadcrumb')
<div class="site-hero clearfix"> <div class="site-hero clearfix">
@@ -44,6 +24,13 @@
</div> </div>
@stop @stop
@section('content') @section('content')
@if(Session::has('status'))
<div class="alert alert-success alert-dismissable">
<i class="fa fa-check-circle"> </i> <b> {!! Lang::get('lang.success') !!} </b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
{{Session::get('status')}}
</div>
@endif
@if (count($errors) > 0) @if (count($errors) > 0)
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
@@ -117,7 +104,6 @@
{!! Form::text('full_name',null,['placeholder'=>Lang::get('lang.full_name'),'class' => 'form-control']) !!} {!! Form::text('full_name',null,['placeholder'=>Lang::get('lang.full_name'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-user form-control-feedback"></span> <span class="glyphicon glyphicon-user form-control-feedback"></span>
{!! $errors->first('full_name', '<spam class="help-block">:message</spam>') !!}
</div> </div>
<!-- Email --> <!-- Email -->
@@ -125,13 +111,11 @@
<div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}"> <div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::text('email',null,['placeholder'=>Lang::get('lang.email'),'class' => 'form-control']) !!} {!! Form::text('email',null,['placeholder'=>Lang::get('lang.email'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
</div> </div>
@elseif (($settings->status == 0 || $settings->status == '0') && ($email_mandatory->status == 0 || $email_mandatory->status == '0')) @elseif (($settings->status == 0 || $settings->status == '0') && ($email_mandatory->status == 0 || $email_mandatory->status == '0'))
<div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}"> <div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::text('email',null,['placeholder'=>Lang::get('lang.email'),'class' => 'form-control']) !!} {!! Form::text('email',null,['placeholder'=>Lang::get('lang.email'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
</div> </div>
@else @else
{!! Form::hidden('email', null) !!} {!! Form::hidden('email', null) !!}
@@ -141,14 +125,12 @@
<div class="col-md-3"> <div class="col-md-3">
<div class="form-group {{ $errors->has('code') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('code') ? 'has-error' : '' }}">
{!! Form::text('code',null,['placeholder'=>91,'class' => 'form-control']) !!} {!! Form::text('code',null,['placeholder'=>91,'class' => 'form-control']) !!}
{!! $errors->first('code', '<spam class="help-block">:message</spam>') !!}
</div> </div>
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
<div class="form-group has-feedback {{ $errors->has('mobile') ? 'has-error' : '' }}"> <div class="form-group has-feedback {{ $errors->has('mobile') ? 'has-error' : '' }}">
{!! Form::text('mobile',null,['placeholder'=>Lang::get('lang.mobile'),'class' => 'form-control']) !!} {!! Form::text('mobile',null,['placeholder'=>Lang::get('lang.mobile'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-phone form-control-feedback"></span> <span class="glyphicon glyphicon-phone form-control-feedback"></span>
{!! $errors->first('mobile', '<spam class="help-block">:message</spam>') !!}
</div> </div>
</div> </div>
</div> </div>
@@ -162,7 +144,6 @@
{!! Form::password('password',['placeholder'=>Lang::get('lang.password'),'class' => 'form-control']) !!} {!! Form::password('password',['placeholder'=>Lang::get('lang.password'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-lock form-control-feedback"></span> <span class="glyphicon glyphicon-lock form-control-feedback"></span>
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
</div> </div>
<!-- Confirm password --> <!-- Confirm password -->
@@ -170,7 +151,6 @@
{!! Form::password('password_confirmation',['placeholder'=>Lang::get('lang.retype_password'),'class' => 'form-control']) !!} {!! Form::password('password_confirmation',['placeholder'=>Lang::get('lang.retype_password'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-log-in form-control-feedback"></span> <span class="glyphicon glyphicon-log-in form-control-feedback"></span>
{!! $errors->first('password_confirmation', '<spam class="help-block">:message</spam>') !!}
</div> </div>

View File

@@ -57,6 +57,7 @@ class = "active"
@if(Session::has('check')) @if(Session::has('check'))
<?php goto a; ?> <?php goto a; ?>
@endif @endif
@if(!Session::has('error'))
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i> <i class="fa fa-ban"></i>
<b>{!! Lang::get('lang.alert') !!} !</b> <b>{!! Lang::get('lang.alert') !!} !</b>
@@ -67,6 +68,7 @@ class = "active"
@endforeach @endforeach
</ul> </ul>
</div> </div>
@endif
<?php a: ?> <?php a: ?>
@endif @endif
<!-- open a form --> <!-- open a form -->

View File

@@ -22,6 +22,18 @@
</div> </div>
@stop @stop
@section('content') @section('content')
@if(!Session::has('error'))
<div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i>
<b>{!! Lang::get('lang.alert') !!} !</b>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div id="content" class="site-content col-md-12"> <div id="content" class="site-content col-md-12">
<div id="corewidgetbox"> <div id="corewidgetbox">
<div class="widgetrow text-center"> <div class="widgetrow text-center">

View File

@@ -150,13 +150,13 @@
@if(Session::has('check')) @if(Session::has('check'))
<?php goto b; ?> <?php goto b; ?>
@endif @endif
<div class="alert alert-danger alert-dismissable">
@if(Session::has('error')) @if(Session::has('error'))
<div class="alert alert-danger alert-dismissable">
{!! Session::get('error') !!} {!! Session::get('error') !!}
@else
{!! Lang::get('lang.required-error') !!}
@endif
</div> </div>
@endif
<?php b: ?> <?php b: ?>
@endif @endif
<div class="form-group has-feedback @if(isset($errors)) {!! $errors->has('email') ? 'has-error' : '' !!} @endif"> <div class="form-group has-feedback @if(isset($errors)) {!! $errors->has('email') ? 'has-error' : '' !!} @endif">