#1182 fixed
This commit is contained in:
parent
eaf82987cf
commit
fd8a1fb851
|
|
@ -40,7 +40,7 @@ class SessionController extends Controller
|
|||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
$this->middleware('auth:' . $this->guard, ['only' => ['get', 'update', 'destroy']]);
|
||||
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerRepository = $customerRepository;
|
||||
|
|
@ -69,7 +69,7 @@ class SessionController extends Controller
|
|||
Event::fire('customer.after.login', request()->input('email'));
|
||||
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
|
||||
return response()->json([
|
||||
'token' => $jwtToken,
|
||||
'message' => 'Logged in successfully.',
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
||||
<label for="password">{{ __('admin::app.users.sessions.password') }}</label>
|
||||
<input type="password" v-validate="'required|min:6'" class="control" id="password" name="password" data-vv-as=""{{ __('admin::app.users.sessions.password') }}"" value="" onblur="hidePassword()" onfocus="showPassword()"/>
|
||||
<input type="password" v-validate="'required|min:6'" class="control" id="password" name="password" data-vv-as=""{{ __('admin::app.users.sessions.password') }}"" value=""/>
|
||||
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -44,37 +44,4 @@
|
|||
|
||||
</div>
|
||||
|
||||
@stop
|
||||
@push('javascript')
|
||||
<script>
|
||||
//default value of password
|
||||
password = '';
|
||||
|
||||
//call the showPass function
|
||||
function setPasswordBack(){
|
||||
showPassword();
|
||||
}
|
||||
|
||||
//hide password from user inspection
|
||||
function hidePassword(){
|
||||
var givenValue = "";
|
||||
var i;
|
||||
p = document.getElementById('password');
|
||||
password = p.value;
|
||||
passwordLength = password.length;
|
||||
|
||||
for (i = 0; i < passwordLength; i++) {
|
||||
givenValue += "*";
|
||||
}
|
||||
|
||||
p.value = givenValue;
|
||||
}
|
||||
|
||||
//show the given password
|
||||
function showPassword(){
|
||||
p = document.getElementById('password');
|
||||
p.type= "password";
|
||||
p.value = password;
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@stop
|
||||
|
|
@ -11,6 +11,7 @@ use Webkul\Sales\Repositories\OrderRepository;
|
|||
use Webkul\Discount\Helpers\Cart\CouponAbleRule as Coupon;
|
||||
use Webkul\Discount\Helpers\Cart\NonCouponAbleRule as NonCoupon;
|
||||
use Webkul\Discount\Helpers\Cart\ValidatesDiscount;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
|
||||
/**
|
||||
* Chekout controller for the customer and guest for placing order
|
||||
|
|
@ -52,6 +53,11 @@ class OnepageController extends Controller
|
|||
*/
|
||||
protected $validatesDiscount;
|
||||
|
||||
/**
|
||||
* customerRepository instance object
|
||||
*/
|
||||
protected $customerRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
|
|
@ -62,7 +68,8 @@ class OnepageController extends Controller
|
|||
OrderRepository $orderRepository,
|
||||
Coupon $coupon,
|
||||
NonCoupon $nonCoupon,
|
||||
ValidatesDiscount $validatesDiscount
|
||||
ValidatesDiscount $validatesDiscount,
|
||||
CustomerRepository $customerRepository
|
||||
)
|
||||
{
|
||||
$this->coupon = $coupon;
|
||||
|
|
@ -73,6 +80,8 @@ class OnepageController extends Controller
|
|||
|
||||
$this->validatesDiscount = $validatesDiscount;
|
||||
|
||||
$this->customerRepository = $customerRepository;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
|
|
@ -324,4 +333,23 @@ class OnepageController extends Controller
|
|||
], 422);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Customer is exist or not
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function checkExistCustomer()
|
||||
{
|
||||
//check customer is exist or not
|
||||
$customer = $this->customerRepository->findOneWhere([
|
||||
'email' => request()->email
|
||||
]);
|
||||
|
||||
//if customer is exist
|
||||
if (! is_null($customer)) {
|
||||
return 'true';
|
||||
}
|
||||
return 'false';
|
||||
}
|
||||
}
|
||||
|
|
@ -165,6 +165,9 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
|||
//resend verification email
|
||||
Route::get('/resend/verification/{email}', 'Webkul\Customer\Http\Controllers\RegistrationController@resendVerificationEmail')->name('customer.resend.verification-email');
|
||||
|
||||
// for customer login checkout
|
||||
Route::post('/custome/exist', 'Webkul\Shop\Http\Controllers\OnepageController@checkExistCustomer')->name('customer.checkout.exist');
|
||||
|
||||
// Auth Routes
|
||||
Route::group(['middleware' => ['customer']], function () {
|
||||
|
||||
|
|
|
|||
|
|
@ -494,7 +494,8 @@ return [
|
|||
'money-desc' => 'Money Transfer',
|
||||
'paypal-desc' => 'Paypal Standard',
|
||||
'free-desc' => 'This is a free shipping',
|
||||
'flat-desc' => 'This is a flat rate'
|
||||
'flat-desc' => 'This is a flat rate',
|
||||
'password' => 'Password'
|
||||
],
|
||||
|
||||
'total' => [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<div class="control-group" id="password" :class="[errors.has('address-form.password') ? 'has-error' : '']">
|
||||
<label for="password" class="required">
|
||||
{{ __('shop::app.checkout.onepage.password') }}
|
||||
</label>
|
||||
|
||||
<input type="password" v-validate="'required|min:6'" class="control" id="password" name="password" v-model="address.billing.password" data-vv-as=""{{ __('shop::app.checkout.onepage.password') }}""/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('address-form.password')">
|
||||
@{{ errors.first('address-form.password') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" id="login-and-forgot-btn" style="display:inline-block;">
|
||||
<div class="forgot-password-link">
|
||||
<a href="{{ route('customer.forgot-password.create') }}">{{ __('shop::app.customer.login-form.forgot_pass') }}</a>
|
||||
<div class="mt-10">
|
||||
@if (Cookie::has('enable-resend'))
|
||||
@if (Cookie::get('enable-resend') == true)
|
||||
<a href="{{ route('customer.resend.verification-email', Cookie::get('email-for-resend')) }}">{{ __('shop::app.customer.login-form.resend-verification') }}</a>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<input type='button' id="" class="btn btn-primary btn-lg btn-login" value="{{ __('shop::app.customer.login-form.button_title') }}" />
|
||||
</div>
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="message"></div>
|
||||
<div class="control-group" :class="[errors.has('address-form.billing[address_id]') ? 'has-error' : '']">
|
||||
<span class="control-error" v-if="errors.has('address-form.billing[address_id]')">
|
||||
@{{ errors.first('address-form.billing[address_id]') }}
|
||||
|
|
@ -67,12 +67,6 @@
|
|||
<div class="form-header">
|
||||
<h1>{{ __('shop::app.checkout.onepage.billing-address') }}</h1>
|
||||
|
||||
@guest('customer')
|
||||
<a class="btn btn-lg btn-primary" href="{{ route('customer.session.index') }}">
|
||||
{{ __('shop::app.checkout.onepage.sign-in') }}
|
||||
</a>
|
||||
@endguest
|
||||
|
||||
@auth('customer')
|
||||
@if(count(auth('customer')->user()->addresses))
|
||||
<a class="btn btn-lg btn-primary" @click = backToSavedBillingAddress()>
|
||||
|
|
@ -118,6 +112,11 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
{{-- for customer login checkout --}}
|
||||
@if (! auth()->guard('customer')->check())
|
||||
@include('shop::checkout.onepage.customer-checkout')
|
||||
@endif
|
||||
|
||||
<div class="control-group" :class="[errors.has('address-form.billing[address1][]') ? 'has-error' : '']">
|
||||
<label for="billing_address_0" class="required">
|
||||
{{ __('shop::app.checkout.onepage.address1') }}
|
||||
|
|
@ -454,3 +453,80 @@
|
|||
@endif
|
||||
|
||||
</form>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#password").hide();
|
||||
$('#login-and-forgot-btn').hide();
|
||||
$("[name='billing[email]']").on('blur', function() {
|
||||
//get the given emai
|
||||
var email = $("[name='billing[email]']").val();
|
||||
|
||||
$.ajax({
|
||||
/* the route pointing to the post function */
|
||||
url: '{{ route('customer.checkout.exist') }}',
|
||||
type: 'POST',
|
||||
|
||||
/* send the csrf-token and the input to the controller with data */
|
||||
data: {'_token': CSRF_TOKEN,
|
||||
'email': email },
|
||||
dataType: 'JSON',
|
||||
|
||||
/* remind that 'data' is the response of the OnePageController */
|
||||
success: function (data) {
|
||||
if (data == true) {
|
||||
$("#password").show();
|
||||
$('#login-and-forgot-btn').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.btn-login').click(function(e) {
|
||||
var email = $("[name='billing[email]']").val();
|
||||
var password = $("[name='password']").val();
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
|
||||
/* the route pointing to the post function */
|
||||
url: '{{ url('/api/customer/login') }}',
|
||||
type: 'POST',
|
||||
|
||||
/* send the csrf-token and the input to the controller with data */
|
||||
data: {'_token': CSRF_TOKEN,
|
||||
'email': email,
|
||||
'password': password
|
||||
},
|
||||
dataType: 'JSON',
|
||||
|
||||
/* remind that 'data' is the response of the OnePageController */
|
||||
success: function (response) {
|
||||
|
||||
if (response.data.email != '') {
|
||||
window.location.href = "{{ route('shop.checkout.onepage.index') }}";
|
||||
}
|
||||
},
|
||||
|
||||
error: function (textStatus, err) {
|
||||
|
||||
var appendData = '<div class="alert alert-error"><span class="icon white-cross-sm-icon"></span><p>Please check your credentials and try again.</p></div>';
|
||||
$('.alert-wrapper').html('');
|
||||
$('.alert-wrapper').append(appendData);
|
||||
|
||||
setTimeout(function () {
|
||||
$('.alert-error').hide();
|
||||
}, 5000);
|
||||
Success = false;//doesnt goes here
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
||||
<label for="password" class="required">{{ __('shop::app.customer.login-form.password') }}</label>
|
||||
<input type="password" v-validate="'required|min:6'" class="control" id="password" name="password" data-vv-as=""{{ __('admin::app.users.sessions.password') }}"" value="" onblur="hidePassword()" onfocus="showPassword()"/>
|
||||
<input type="password" v-validate="'required|min:6'" class="control" id="password" name="password" data-vv-as=""{{ __('admin::app.users.sessions.password') }}"" value=""/>
|
||||
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -54,36 +54,4 @@
|
|||
</div>
|
||||
|
||||
@stop
|
||||
@push('scripts')
|
||||
<script>
|
||||
//default value of password
|
||||
password = '';
|
||||
|
||||
//call the showPass function
|
||||
function setPasswordBack(){
|
||||
showPassword();
|
||||
}
|
||||
|
||||
//hide password from user inspection
|
||||
function hidePassword(){
|
||||
var givenValue = "";
|
||||
var i;
|
||||
p = document.getElementById('password');
|
||||
password = p.value;
|
||||
passwordLength = password.length;
|
||||
|
||||
for (i = 0; i < passwordLength; i++) {
|
||||
givenValue += "*";
|
||||
}
|
||||
|
||||
p.value = givenValue;
|
||||
}
|
||||
|
||||
//show the given password
|
||||
function showPassword(){
|
||||
p = document.getElementById('password');
|
||||
p.type= "password";
|
||||
p.value = password;
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SessionController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue