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,56 +150,61 @@ class AuthController extends Controller
*/
public function postRegister(User $user, RegisterRequest $request)
{
$request_array = $request->input();
$password = Hash::make($request->input('password'));
$user->password = $password;
$name = $request->input('full_name');
$user->first_name = $name;
if ($request_array['email'] == '') {
$user->email = null;
} else {
$user->email = $request->input('email');
}
if ($request_array['mobile'] == '') {
try{
$request_array = $request->input();
$password = Hash::make($request->input('password'));
$user->password = $password;
$name = $request->input('full_name');
$user->first_name = $name;
if ($request_array['email'] == '') {
$user->email = null;
} else {
$user->email = $request->input('email');
}
if ($request_array['mobile'] == '') {
$user->mobile = null;
} else {
$user->mobile = $request->input('mobile');
}
if ($request_array['code'] == '') {
$user->country_code = 0;
} else {
$user->country_code = $request->input('code');
}
if ($request_array['email'] != '') {
$user->user_name = $request->input('email');
} else {
$user->user_name = $request->input('mobile');
}
$user->role = 'user';
$code = str_random(60);
$user->remember_token = $code;
$user->save();
$message12 = '';
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$sms = Plugin::select('status')->where('name', '=', 'SMS')->first();
// Event for login
\Event::fire(new \App\Events\LoginEvent($request));
$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 (count($sms) > 0) {
if ($sms->status == 1 || $sms->status == '1') {
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_and_moble');
} else {
$user->mobile = $request->input('mobile');
}
if ($request_array['code'] == '') {
$user->country_code = 0;
} else {
$user->country_code = $request->input('code');
}
if ($request_array['email'] != '') {
$user->user_name = $request->input('email');
} else {
$user->user_name = $request->input('mobile');
}
$user->role = 'user';
$code = str_random(60);
$user->remember_token = $code;
$user->save();
$message12 = '';
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
$sms = Plugin::select('status')->where('name', '=', 'SMS')->first();
// Event for login
\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)]);
}
if ($settings->status == 1 || $settings->status == '1') {
if (count($sms) > 0) {
if ($sms->status == 1 || $sms->status == '1') {
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_and_moble');
} else {
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_sms_plugin_inactive_or_not_setup');
}
} else {
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_sms_plugin_inactive_or_not_setup');
}
} else {
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail_sms_plugin_inactive_or_not_setup');
$message12 = Lang::get('lang.activate_your_account_click_on_Link_that_send_to_your_mail');
}
} else {
$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 Exception;
use Mail;
use Lang;
class PhpMailController extends Controller
{
@@ -75,7 +76,7 @@ class PhpMailController extends Controller
{
$from_address = $this->fetch_smtp_details($from);
if ($from_address == null) {
throw new Exception('Invalid Email Configuration');
throw new Exception(Lang::get('lang.system-email-not-configured'));
}
$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_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.',
'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_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 **********/
'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">
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
@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)
@@ -43,6 +37,24 @@
</div>
@stop
@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)
<div class="alert alert-danger alert-dismissable">
<i class="fa fa-ban"></i>
@@ -53,6 +65,8 @@
@endforeach
</div>
@endif
@endif
<div id="content" class="site-content col-md-12">
<div id="corewidgetbox">
<div class="widgetrow text-center">
@@ -115,7 +129,6 @@
<div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::text('email',null,['placeholder'=> Lang::get("lang.email") ,'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
</div>
</div>
@@ -126,7 +139,6 @@
{!! Form::password('password',['placeholder'=>Lang::get("lang.password"),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
</div>
</div>

View File

@@ -14,26 +14,6 @@
<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:// -->
@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')
<div class="site-hero clearfix">
@@ -44,6 +24,13 @@
</div>
@stop
@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)
<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']) !!}
<span class="glyphicon glyphicon-user form-control-feedback"></span>
{!! $errors->first('full_name', '<spam class="help-block">:message</spam>') !!}
</div>
<!-- Email -->
@@ -125,13 +111,11 @@
<div class="form-group has-feedback {{ $errors->has('email') ? 'has-error' : '' }}">
{!! Form::text('email',null,['placeholder'=>Lang::get('lang.email'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
</div>
@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' : '' }}">
{!! Form::text('email',null,['placeholder'=>Lang::get('lang.email'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
{!! $errors->first('email', '<spam class="help-block">:message</spam>') !!}
</div>
@else
{!! Form::hidden('email', null) !!}
@@ -141,14 +125,12 @@
<div class="col-md-3">
<div class="form-group {{ $errors->has('code') ? 'has-error' : '' }}">
{!! Form::text('code',null,['placeholder'=>91,'class' => 'form-control']) !!}
{!! $errors->first('code', '<spam class="help-block">:message</spam>') !!}
</div>
</div>
<div class="col-md-9">
<div class="form-group has-feedback {{ $errors->has('mobile') ? 'has-error' : '' }}">
{!! Form::text('mobile',null,['placeholder'=>Lang::get('lang.mobile'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-phone form-control-feedback"></span>
{!! $errors->first('mobile', '<spam class="help-block">:message</spam>') !!}
</div>
</div>
</div>
@@ -162,7 +144,6 @@
{!! Form::password('password',['placeholder'=>Lang::get('lang.password'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
{!! $errors->first('password', '<spam class="help-block">:message</spam>') !!}
</div>
<!-- Confirm password -->
@@ -170,7 +151,6 @@
{!! Form::password('password_confirmation',['placeholder'=>Lang::get('lang.retype_password'),'class' => 'form-control']) !!}
<span class="glyphicon glyphicon-log-in form-control-feedback"></span>
{!! $errors->first('password_confirmation', '<spam class="help-block">:message</spam>') !!}
</div>

View File

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

View File

@@ -22,6 +22,18 @@
</div>
@stop
@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="corewidgetbox">
<div class="widgetrow text-center">

View File

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