|
@@ -190,7 +190,8 @@ class UserController extends Controller
|
|
|
|
|
|
|
|
|
if ($request->has(['email','username', 'wechat', 'qq'])) {
|
|
|
- $data = $request->only(['email','username', 'wechat', 'qq']);
|
|
|
+
|
|
|
+ $data = $request->only(['newemail','email','username', 'wechat', 'qq']);
|
|
|
|
|
|
|
|
|
|
|
@@ -198,17 +199,33 @@ class UserController extends Controller
|
|
|
|
|
|
|
|
|
|
|
|
- if ( User::where('email', $data['email'])->count() >= 1) {
|
|
|
+ if ( User::where('email', $data['newemail'])->count() >= 1) {
|
|
|
return Redirect::back()->withErrors(trans('common.update_action', ['action' => trans('common.failed_email')]));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (empty($data['username'])) {
|
|
|
return Redirect::back()->withErrors(trans('validation.required', ['attribute' => trans('validation.attributes.username')]));
|
|
|
}
|
|
|
|
|
|
- if (! $user->update($data)) {
|
|
|
+ $newData = [
|
|
|
+ 'email' => $data['newemail'],
|
|
|
+ 'wechat' => $data['wechat'],
|
|
|
+ 'qq' => $data['qq'],
|
|
|
+ 'ol_emil' => $data['email'],
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (! $user->update($newData)) {
|
|
|
return Redirect::back()->withErrors(trans('common.update_action', ['action' => trans('common.failed')]));
|
|
|
}
|
|
|
+
|
|
|
+ Helpers::addEmailLog($user->id,$data['email'],$data['newemail']);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|