Email Subcription flow changed, email verfication enhancements for resending the email, reset password redirect issue solved and many other issue fixes

This commit is contained in:
prashant-webkul 2018-11-28 12:59:08 +05:30
parent bf63545895
commit a29feaf83f
19 changed files with 109 additions and 138 deletions

View File

@ -123,12 +123,12 @@ class CategoryDataGrid
'filterable' => [
[
'column' => 'cat.id',
'alias' => 'catID',
'alias' => 'cat_id',
'type' => 'number',
'label' => 'Category ID',
], [
'column' => 'ct.name',
'alias' => 'catName',
'alias' => 'cat_name',
'type' => 'string',
'label' => 'Category Name',
],
@ -140,7 +140,7 @@ class CategoryDataGrid
// ],
[
'column' => 'cat.status',
'alias' => 'catStatus',
'alias' => 'cat_status',
'type' => 'string',
'label' => 'Visible in Menu',
],

View File

@ -68,54 +68,47 @@ class ExchangeRatesDataGrid
//use aliasing on secodary columns if join is performed
'columns' => [
[
'name' => 'cer.id',
'alias' => 'exchID',
'alias' => 'exchid',
'type' => 'number',
'label' => 'Rate ID',
'sortable' => true,
],
[
], [
'name' => 'curr.name',
'alias' => 'currencyname',
'alias' => 'exchcurrname',
'type' => 'string',
'label' => 'Currency Name',
'sortable' => true,
],
[
], [
'name' => 'cer.rate',
'alias' => 'exchRate',
'alias' => 'exchrate',
'type' => 'string',
'label' => 'Exchange Rate',
],
],
//don't use aliasing in case of filters
'filterable' => [
[
'column' => 'cer.id',
'alias' => 'exchId',
'alias' => 'exchid',
'type' => 'number',
'label' => 'Rate ID',
],
[
], [
'column' => 'curr.name',
'alias' => 'exchTargetCurrency',
'alias' => 'exchcurrname',
'type' => 'string',
'label' => 'Target Currency',
'sortable' => true,
'label' => 'Currency Name',
],
],
//don't use aliasing in case of searchables
'searchable' => [
[
'column' => 'target_currency',
'column' => 'exchcurrname',
'type' => 'string',
'label' => 'Target Currency',
'label' => 'Currency Name',
],
],

View File

@ -4,6 +4,7 @@ namespace Webkul\Admin\DataGrids;
use Illuminate\View\View;
use Webkul\Ui\DataGrid\Facades\DataGrid;
use DB;
/**
* OrderShipmentsDataGrid
@ -82,7 +83,10 @@ class OrderShipmentsDataGrid
'alias' => 'order_customer_first_name',
'type' => 'string',
'label' => 'Customer Name',
'sortable' => false
'sortable' => false,
// 'wrapper' => function($value) {
// return $value.$last_name;
// }
], [
'name' => 'ors.created_at',
'alias' => 'orscreated',

View File

@ -32,7 +32,7 @@
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('admin::app.users.users.email') }}</label>
<label for="email" class="required">{{ __('admin::app.users.users.email') }}</label>
<input type="text" v-validate="'required|email'" class="control" id="email" name="email"/>
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
@ -42,13 +42,13 @@
<accordian :title="'{{ __('Password') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
<label for="password">{{ __('admin::app.users.users.password') }}</label>
<label for="password" class="required">{{ __('admin::app.users.users.password') }}</label>
<input type="password" v-validate="'min:6|max:18'" class="control" id="password" name="password"/>
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
</div>
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
<label for="password_confirmation">{{ __('admin::app.users.users.confirm-password') }}</label>
<label for="password_confirmation" class="required">{{ __('admin::app.users.users.confirm-password') }}</label>
<input type="password" v-validate="'min:6|max:18|confirmed:password'" class="control" id="password_confirmation" name="password_confirmation"/>
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
</div>

View File

@ -4,7 +4,6 @@
{{ __('admin::app.users.users.edit-user-title') }}
@stop
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.users.update', $user->id) }}" @submit.prevent="onSubmit">
@ -34,7 +33,7 @@
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('admin::app.users.users.email') }}</label>
<label for="email" class="required">{{ __('admin::app.users.users.email') }}</label>
<input type="text" v-validate="'required|email'" class="control" id="email" name="email" value="{{ $user->email }}"/>
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>

View File

@ -105,15 +105,23 @@ class CustomerController extends Controller
$data = collect(request()->input())->except('_token')->toArray();
if($data['date_of_birth'] == "") {
unset($data['date_of_birth']);
}
if($data['oldpassword'] == null) {
$data = collect(request()->input())->except(['_token','password','password_confirmation','oldpassword'])->toArray();
if($data['date_of_birth'] == "") {
unset($data['date_of_birth']);
}
if($this->customer->update($data, $id)) {
Session()->flash('success','Profile Updated Successfully');
Session()->flash('success', trans('shop::app.customer.account.profile.edit-success'));
return redirect()->back();
} else {
Session()->flash('success','Profile Cannot Be Updated Successfully');
Session()->flash('success', trans('shop::app.customer.account.profile.edit-fail'));
return redirect()->back();
}
@ -122,18 +130,22 @@ class CustomerController extends Controller
$data = collect(request()->input())->except(['_token','oldpassword'])->toArray();
$data['password'] = bcrypt($data['password']);
if($data['date_of_birth'] == "") {
unset($data['date_of_birth']);
}
} else {
session()->flash('warning', 'The Old Password Does Not Match');
session()->flash('warning', trans('shop::app.customer.account.profile.unmatch'));
return redirect()->back();
}
if($this->customer->update($data, $id)) {
Session()->flash('success','Profile Updated Successfully');
Session()->flash('success', trans('shop::app.customer.account.profile.edit-success'));
return redirect()->back();
} else {
Session()->flash('success','Profile Cannot Be Updated Successfully');
Session()->flash('success', trans('shop::app.customer.account.profile.edit-fail'));
return redirect()->back();
}

View File

@ -62,7 +62,6 @@ class ResetPasswordController extends Controller
*/
public function store()
{
//dd(request()->input());
$this->validate(request(), [
'token' => 'required',
'email' => 'required|email',
@ -74,7 +73,7 @@ class ResetPasswordController extends Controller
$this->resetPassword($customer, $password);
}
);
// dd($response);
if($response == Password::PASSWORD_RESET) {
return redirect()->route($this->_config['redirect']);
}

View File

@ -55,7 +55,7 @@ class WishlistController extends Controller
'channel_id' => core()->getCurrentChannel()->id,
'customer_id' => auth()->guard('customer')->user()->id]
);
// dd($wishlistItems->count());
return view($this->_config['view'])->with('items', $wishlistItems);
}
@ -76,7 +76,7 @@ class WishlistController extends Controller
$checked = $this->wishlist->findWhere(['channel_id' => core()->getCurrentChannel()->id, 'product_id' => $itemId, 'customer_id' => auth()->guard('customer')->user()->id]);
//accidental case if some one adds id of the product in the anchor tag amd gives id of a variant.
if($product->parent_id != null || $product->parent_id != 'null') {
if($product->parent_id != null) {
$product = $this->product->findOneByField('id', $product->parent_id);
$data['product_id'] = $product->parent_id;
}
@ -149,7 +149,7 @@ class WishlistController extends Controller
return redirect()->back();
}
session()->flash('warning', trans('shop::app.checkout.cart.add-config-warning'));
session()->flash('info', trans('shop::app.checkout.cart.add-config-warning'));
return redirect()->route('shop.products.index', $wishlistItem->product->url_key);
}

View File

@ -19,7 +19,6 @@ use Webkul\Core\Repositories\SubscribersListRepository as Subscription;
*/
class SubscriptionController extends Controller
{
/**
* User object
*
@ -48,17 +47,13 @@ class SubscriptionController extends Controller
*/
public function __construct(Customer $customer, Subscription $subscription)
{
$this->user = auth()->guard('customer')->user();
$this->customer = $customer;
$this->subscription = $subscription;
$this->_config = request('_config');
}
/**
* Subscribes Customers and Guests to subscription mailing list and checks if already subscribed
* Subscribes email to the email subscription list
*/
public function subscribe()
{
@ -70,44 +65,27 @@ class SubscriptionController extends Controller
$unique = 0;
if(auth()->guard('customer')->check()) {
$unique = function() use($email) {
$count = $this->customer->findWhere(['email' => $email]);
$alreadySubscribed = $this->subscription->findWhere(['email' => $email]);
if($count->count() > 0 && $count->first()->subscribed_to_news_letter == 1) {
return 0;
} else {
return 1;
}
};
} else {
$alreadySubscribed = $this->subscription->findWhere(['email' => $email]);
$unique = function() use($alreadySubscribed){
if($alreadySubscribed->count() > 0 ) {
return 0;
} else {
return 1;
}
};
}
$unique = function() use($alreadySubscribed){
if($alreadySubscribed->count() > 0 ) {
return 0;
} else {
return 1;
}
};
if($unique()) {
$token = uniqid();
$result = false;
if(!auth()->guard('customer')->check()) {
$result = $this->subscription->create([
'email' => $email,
'channel_id' => core()->getCurrentChannel()->id,
'is_subscribed' => 1,
'token' => $token
]);
} else {
$user = auth()->guard('customer')->user();
$token = auth()->guard('customer')->user()->email;
$result = $user->update(['subscribed_to_news_letter' => 1]);
}
$result = $this->subscription->create([
'email' => $email,
'channel_id' => core()->getCurrentChannel()->id,
'is_subscribed' => 1,
'token' => $token
]);
if(!$result) {
session()->flash('error', trans('shop::app.subscription.not-subscribed'));
@ -121,12 +99,8 @@ class SubscriptionController extends Controller
Mail::send(new SubscriptionEmail($subscriptionData));
session()->flash('success', trans('shop::app.subscription.subscribed'));
return redirect()->back();
} else {
session()->flash('error', trans('shop::app.subscription.already'));
return redirect()->back();
}
return redirect()->back();
@ -138,27 +112,14 @@ class SubscriptionController extends Controller
* @var string $token
*/
public function unsubscribe($token) {
if(auth()->guard('customer')->check()) {
if(auth()->guard('customer')->user()->email == $token) {
auth()->guard('customer')->user()->update(['subscribed_to_news_letter' => 0]);
session('info', 'You Are Unsubscribed');
} else {
session()->flash('warning', 'You must be logged in with correct to unsubscribe');
}
$subscriber = $this->subscription->findOneByField('token', $token);
if($subscriber->count() > 0 && $subscriber->is_subscribed == 1 &&$subscriber->update(['is_subscribed' => 0])) {
session()->flash('info', trans('shop::app.subscription.unsubscribed'));
} else {
$subscriber = $this->subscription->findOneByField('token', $token);
if($subscriber->count() > 0 && $subscriber->delete()) {
session('info', 'You Are Unsubscribed');
} else {
session('info', 'You Have Already Unsubscribed');
}
if($this->customer->findOneByField('email', $token)) {
session('info', 'You must Logged In To Unsubscribe');
}
session()->flash('info', trans('shop::app.subscription.already-unsub'));
}
return redirect()->back();
return redirect()->route('shop.home.index');
}
}

View File

@ -12,7 +12,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
Route::get('/subscribe', 'Webkul\Shop\Http\Controllers\SubscriptionController@subscribe')->name('shop.subscribe');
//unsubscribe
Route::get('/unsubscribe', 'Webkul\Shop\Http\Controllers\SubscriptionController@unSubscribe')->name('shop.unsubscribe');
Route::get('/unsubscribe/{token}', 'Webkul\Shop\Http\Controllers\SubscriptionController@unsubscribe')->name('shop.unsubscribe');
//Store front header nav-menu fetch
Route::get('/categories/{slug}', 'Webkul\Shop\Http\Controllers\CategoryController@index')->defaults('_config', [
@ -125,7 +125,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
// Reset Password Form Store
Route::post('/reset-password', 'Webkul\Customer\Http\Controllers\ResetPasswordController@store')->defaults('_config', [
'redirect' => 'customer.session.index'
'redirect' => 'customer.profile.index'
])->name('customer.reset-password.store');
// Login Routes

View File

@ -33,7 +33,9 @@ return [
'subscribe' => 'Subscribe',
'subscribed' => 'You Are Now Subscribed To Subscription Emails',
'not-subscribed' => 'You Cannot Be Subscribed To Subscription Emails, Try Again After Some time',
'already' => 'You Are Already Subscribed To Our Subscription List'
'already' => 'You Are Already Subscribed To Our Subscription List',
'unsubscribed' => 'You Are Unsubscribed From Bagisto Subscription Mails',
'already-unsub' => 'You Are Already Unsubscribed'
],
'search' => [
@ -130,6 +132,10 @@ return [
'edit' => 'Edit',
],
'edit-success' => 'Profile Updated Successfully',
'edit-fail' => 'Error! Profile Cannot Be Updated, Please Try Again Later',
'unmatch' => 'The Old Password Does Not Match',
'fname' => 'First Name',
'lname' => 'Last Name',
'gender' => 'Gender',

View File

@ -58,22 +58,22 @@
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('old_password') ? 'has-error' : '']">
<div class="control-group" :class="[errors.has('oldpassword') ? 'has-error' : '']">
<label for="password">{{ __('shop::app.customer.account.profile.opassword') }}</label>
<input type="password" class="control" name="oldpassword" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.opassword') }}&quot;">
<input type="password" class="control" name="oldpassword" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.opassword') }}&quot;" v-validate="'min:6'">
<span class="control-error" v-if="errors.has('oldpassword')">@{{ errors.first('oldpassword') }}</span>
</div>
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
<label for="password">{{ __('shop::app.customer.account.profile.password') }}</label>
<input type="password" class="control" name="password" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.password') }}&quot;">
<input type="password" id="password" class="control" name="password" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.password') }}&quot;" v-validate="'min:6'">
<span class="control-error" v-if="errors.has('password')">@{{ errors.first('password') }}</span>
</div>
<div class="control-group" :class="[errors.has('password_confirmation') ? 'has-error' : '']">
<label for="password">{{ __('shop::app.customer.account.profile.cpassword') }}</label>
<input type="password" class="control" name="password_confirmation" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.cpassword') }}&quot;">
<span>@{{ errors.first('password_confirmation') }}</span>
<input type="password" id="password_confirmation" class="control" name="password_confirmation" data-vv-as="&quot;{{ __('shop::app.customer.account.profile.cpassword') }}&quot;" v-validate="'min:6|confirmed:password'">
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
</div>
<div class="button-group">

View File

@ -53,14 +53,14 @@
<td>{{ $customer->email }}</td>
</tr>
@if($customer->subscribed_to_news_letter == 1)
{{-- @if($customer->subscribed_to_news_letter == 1)
<tr>
<td> {{ __('shop::app.footer.subscribe-newsletter') }}</td>
<td>
<a class="btn btn-sm btn-primary" href="{{ route('shop.unsubscribe', $customer->email) }}">{{ __('shop::app.subscription.unsubscribe') }} </a>
</td>
</tr>
@endif
@endif --}}
</tbody>
</table>

View File

@ -8,16 +8,18 @@
</div>
<div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px">
{{ __('shop::app.subscription.title') }}
Welcome to Bagisto - Email Subscription
</div>
<div>
{{ __('shop::app.subscription.message') }}
Thanks for putting me into your inbox. Its been a while since youve read Bagisto
email, and we dont want to overwhelm your inbox. If you still do not want to receive
the latest email marketing news then for sure click the button below.
</div>
<div style="margin-top: 40px; text-align: center">
<a href="{{ route('shop.unsubscribe', $data['token']) }}" href="#" style="font-size: 16px;
color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;"> {{ __('shop::app.subscription.unsubscribe') }} </a>
<a href="{{ route('shop.unsubscribe', $data['token']) }}" style="font-size: 16px;
color: #FFFFFF; text-align: center; background: #0031F0; padding: 10px 100px;text-decoration: none;">Unsubscribe</a>
</div>
</div>

View File

@ -8,11 +8,12 @@
</div>
<div style="font-size:16px; color:#242424; font-weight:600; margin-top: 60px; margin-bottom: 15px">
{{ __('shop::app.subscription.title') }}
Bagisto - Email Verification
</div>
<div>
{{ __('shop::app.subscription.message') }}
This is the mail to verify that the email address you entered is yours.
Kindly click the 'Verify Your Account' button below to verify your account.
</div>
<div style="margin-top: 40px; text-align: center">

View File

@ -18,12 +18,10 @@
<div class="list-container">
<span class="list-heading">{{ __('shop::app.footer.subscribe-newsletter') }}</span>
<div class="form-container">
<form action="{{ route('shop.subscribe') }}" @submit.prevent="onSubmit">
<form action="{{ route('shop.subscribe') }}">
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<input type="text" class="control subscribe-field" name="email" placeholder="Email Address" required><br/>
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
<button class="btn btn-md btn-primary">{{ __('shop::app.subscription.subscribe') }}</button>
</div>
</form>

View File

@ -39,9 +39,9 @@
<div class="quantity control-group" :class="[errors.has('quantity') ? 'has-error' : '']">
<label class="reqiured">{{ __('shop::app.products.quantity') }}</label>
<label class="required">{{ __('shop::app.products.quantity') }}</label>
<input name="quantity" class="control" value="1" v-validate="'required|numeric|min_value:1'" style="width: 60px;">
<input name="quantity" class="control" value="1" v-validate="'required|numeric|min_value:1'" style="width: 60px;" data-vv-as="&quot;{{ __('shop::app.products.quantity') }}&quot;">
<span class="control-error" v-if="errors.has('quantity')">@{{ errors.first('quantity') }}</span>
</div>

View File

@ -12,9 +12,9 @@
<input type="hidden" name="selected_configurable_option" :value="selectedProductId">
<div v-for='(attribute, index) in childAttributes' class="attribute control-group" :class="[errors.has('super_attribute[' + attribute.id + ']') ? 'has-error' : '']">
<label class="reqiured">@{{ attribute.label }}</label>
<label class="required">@{{ attribute.label }}</label>
<select v-validate="'required'" class="control" :name="['super_attribute[' + attribute.id + ']']" :disabled="attribute.disabled" @change="configure(attribute, $event.target.value)" :id="['attribute_' + attribute.id]">
<select v-validate="'required'" class="control" :name="['super_attribute[' + attribute.id + ']']" :disabled="attribute.disabled" @change="configure(attribute, $event.target.value)" :id="['attribute_' + attribute.id]" :data-vv-as="'&quot;' + attribute.label + '&quot;'">
<option v-for='(option, index) in attribute.options' :value="option.id">@{{ option.label }}</option>
@ -98,23 +98,23 @@
}
//wishlist anchor href changer with options
@auth('customer')
var wishlistLink = $('#wishlist-changer').attr('data-href');
// @auth('customer')
// var wishlistLink = $('#wishlist-changer').attr('data-href');
if(this.selectedProductId != '') {
var splitted = wishlistLink.split("/");
// if(this.selectedProductId != '') {
// var splitted = wishlistLink.split("/");
var lastItem = splitted.pop();
// var lastItem = splitted.pop();
lastItem = this.selectedProductId;
// lastItem = this.selectedProductId;
var joined = splitted.join('/');
// var joined = splitted.join('/');
var newWishlistUrl = joined + '/' + lastItem;
// var newWishlistUrl = joined + '/' + lastItem;
$('#wishlist-changer').attr('data-href', newWishlistUrl);
}
@endauth
// $('#wishlist-changer').attr('data-href', newWishlistUrl);
// }
// @endauth
//buy now anchor href changer with options
var buyNowLink = $('.btn.buynow').attr('data-href');

View File

@ -34,19 +34,15 @@
</ul>
<div class="product-hero-image" id="product-hero-image">
<img :src="currentLargeImageUrl" id="pro-img"/>
{{-- Uncomment the line below for activating share links --}}
{{-- @include('shop::products.sharelinks') --}}
@auth('customer')
<button type="submit" class="add-to-wishlist" data-href="{{ route('customer.wishlist.add', $product->id) }}" id="wishlist-changer">
</button>
<a class="add-to-wishlist" href="{{ route('customer.wishlist.add', $product->id) }}">
</a>
@endauth
</div>
</div>
</script>