fixed issue 398 for wrong flash notifications due to improper validations and removed the phone field from the customer as it was no longer available in the customers table
This commit is contained in:
parent
3a69f76b96
commit
be941760f8
|
|
@ -99,8 +99,8 @@ class CustomerController extends Controller
|
|||
'gender' => 'required',
|
||||
'date_of_birth' => 'date|before:today',
|
||||
'email' => 'email|unique:customers,email,'.$id,
|
||||
'phone' => 'nullable|numeric|unique:customers,phone,'. $id,
|
||||
'password' => 'confirmed'
|
||||
'oldpassword' => 'required_with:password',
|
||||
'password' => 'confirmed|min:6'
|
||||
]);
|
||||
|
||||
$data = collect(request()->input())->except('_token')->toArray();
|
||||
|
|
@ -109,46 +109,26 @@ class CustomerController extends Controller
|
|||
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', trans('shop::app.customer.account.profile.edit-success'));
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
Session()->flash('success', trans('shop::app.customer.account.profile.edit-fail'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
} else {
|
||||
if (Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
|
||||
$data = collect(request()->input())->except(['_token','oldpassword'])->toArray();
|
||||
|
||||
if ($data['oldpassword'] != "" || $data['oldpassword'] != null) {
|
||||
if(Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) {
|
||||
$data['password'] = bcrypt($data['password']);
|
||||
|
||||
if ($data['date_of_birth'] == "") {
|
||||
unset($data['date_of_birth']);
|
||||
}
|
||||
} else {
|
||||
session()->flash('warning', trans('shop::app.customer.account.profile.unmatch'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
} else {
|
||||
unset($data['password']);
|
||||
}
|
||||
|
||||
if ($this->customer->update($data, $id)) {
|
||||
Session()->flash('success', trans('shop::app.customer.account.profile.edit-success'));
|
||||
if ($this->customer->update($data, $id)) {
|
||||
Session()->flash('success', trans('shop::app.customer.account.profile.edit-success'));
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
Session()->flash('success', trans('shop::app.customer.account.profile.edit-fail'));
|
||||
return redirect()->back();
|
||||
} else {
|
||||
Session()->flash('success', trans('shop::app.customer.account.profile.edit-fail'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ return [
|
|||
'wishlist' => 'Wishlist',
|
||||
'orders' => 'Orders',
|
||||
],
|
||||
|
||||
|
||||
'common' => [
|
||||
'error' => 'Something went wrong, please try again later.'
|
||||
],
|
||||
|
|
@ -169,8 +169,8 @@ return [
|
|||
'phone' => 'Phone',
|
||||
'email' => 'Email',
|
||||
'opassword' => 'Old Password',
|
||||
'password' => 'Password',
|
||||
'cpassword' => 'Confirm Password',
|
||||
'password' => 'New Password',
|
||||
'cpassword' => 'Confirm New Password',
|
||||
'submit' => 'Update Profile',
|
||||
|
||||
'edit-profile' => [
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.shop.customers.account.profile.edit.before', ['customer' => $customer]) !!}
|
||||
|
||||
<form method="post" action="{{ route('customer.profile.edit') }}">
|
||||
<form method="post" action="{{ route('customer.profile.edit') }}" @submit.prevent="onSubmit">
|
||||
|
||||
<div class="edit-form">
|
||||
@csrf
|
||||
|
|
@ -30,18 +30,21 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
|
||||
<label for="first_name" class="required">{{ __('shop::app.customer.account.profile.fname') }}</label>
|
||||
|
||||
<input type="text" class="control" name="first_name" value="{{ old('first_name') ?? $customer->first_name }}" v-validate="'required'" data-vv-as=""{{ __('shop::app.customer.account.profile.fname') }}"">
|
||||
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
|
||||
<label for="last_name" class="required">{{ __('shop::app.customer.account.profile.lname') }}</label>
|
||||
|
||||
<input type="text" class="control" name="last_name" value="{{ old('last_name') ?? $customer->last_name }}" v-validate="'required'" data-vv-as=""{{ __('shop::app.customer.account.profile.lname') }}"">
|
||||
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
|
||||
<label for="email" class="required">{{ __('shop::app.customer.account.profile.gender') }}</label>
|
||||
|
||||
<select name="gender" class="control" v-validate="'required'" data-vv-as=""{{ __('shop::app.customer.account.profile.gender') }}"">
|
||||
<option value="" @if ($customer->gender == "") selected @endif></option>
|
||||
<option value="Other" @if ($customer->gender == "Other") selected @endif>Other</option>
|
||||
|
|
@ -63,12 +66,6 @@
|
|||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
|
||||
<label for="phone">{{ __('shop::app.customer.account.profile.phone') }}</label>
|
||||
<input type="text" class="control" name="phone" v-validate="'numeric|max:10'" value="{{ old('phone') ?? $customer->phone }}" data-vv-as=""{{ __('shop::app.customer.account.profile.phone') }}"">
|
||||
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
|
||||
</div>
|
||||
|
||||
<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=""{{ __('shop::app.customer.account.profile.opassword') }}"" v-validate="'min:6'">
|
||||
|
|
@ -77,12 +74,14 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
||||
<label for="password">{{ __('shop::app.customer.account.profile.password') }}</label>
|
||||
|
||||
<input type="password" id="password" class="control" name="password" data-vv-as=""{{ __('shop::app.customer.account.profile.password') }}"" 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" id="password_confirmation" class="control" name="password_confirmation" data-vv-as=""{{ __('shop::app.customer.account.profile.cpassword') }}"" v-validate="'min:6|confirmed:password'">
|
||||
<span class="control-error" v-if="errors.has('password_confirmation')">@{{ errors.first('password_confirmation') }}</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -55,11 +55,6 @@
|
|||
<td>{{ $customer->email }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{{ __('shop::app.customer.account.profile.phone') }}</td>
|
||||
<td>{{ $customer->phone }}</td>
|
||||
</tr>
|
||||
|
||||
{{-- @if ($customer->subscribed_to_news_letter == 1)
|
||||
<tr>
|
||||
<td> {{ __('shop::app.footer.subscribe-newsletter') }}</td>
|
||||
|
|
|
|||
|
|
@ -21,10 +21,8 @@
|
|||
|
||||
<div class="category-block">
|
||||
<div class="hero-image mb-35">
|
||||
@if (! is_null($category->image))
|
||||
|
||||
@if (!is_null($category->image))
|
||||
<img class="logo" src="{{ $category->image_url }}" />
|
||||
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
|
@ -49,7 +47,7 @@
|
|||
@foreach ($products as $product)
|
||||
|
||||
@include ('shop::products.list.card', ['product' => $productFlat->product])
|
||||
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -265,7 +265,6 @@ h2 {
|
|||
vertical-align: top;
|
||||
|
||||
&.actions {
|
||||
text-align: right;
|
||||
|
||||
.icon {
|
||||
cursor: pointer;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
@endforeach
|
||||
|
||||
@if ($enableActions)
|
||||
<td>
|
||||
<div class="actions">
|
||||
<td class="actions" style="width: 100px;">
|
||||
<div>
|
||||
@foreach ($actions as $action)
|
||||
<a href="{{ route($action['route'], $record->{$index}) }}">
|
||||
<span class="{{ $action['icon'] }}"></span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue