|
@@ -190,7 +190,8 @@ class UserController extends Controller
|
|
|
|
|
|
// 修改联系方式
|
|
|
if ($request->has(['email','username', 'wechat', 'qq'])) {
|
|
|
- $data = $request->only(['email','username', 'wechat', 'qq']);
|
|
|
+ //ol_emil
|
|
|
+ $data = $request->only(['newemail','email','username', 'wechat', 'qq']);
|
|
|
// $ip = IP::getClientIP();
|
|
|
// $vercode = Cache::get('send_verify_code_'.md5($ip), $ip);
|
|
|
//
|
|
@@ -198,17 +199,33 @@ class UserController extends Controller
|
|
|
// return Redirect::back()->withErrors(trans('common.update_action', ['action' => trans('common.failed_code')]));
|
|
|
// }
|
|
|
|
|
|
- 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['qq'])) {
|
|
|
+// return Redirect::back()->withErrors(trans('validation.required', ['attribute' => trans('validation.attributes.qq')]));
|
|
|
+// }
|
|
|
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'],
|
|
|
+ ];
|
|
|
+// var_dump($newData); die();
|
|
|
+// $data['old_email'] = $data['email'];
|
|
|
+// $data['email'] = $data['newemail'];
|
|
|
+// var_dump($data);
|
|
|
+// die();
|
|
|
+ if (! $user->update($newData)) {
|
|
|
return Redirect::back()->withErrors(trans('common.update_action', ['action' => trans('common.failed')]));
|
|
|
}
|
|
|
+
|
|
|
+ Helpers::addEmailLog($user->id,$data['email'],$data['newemail']);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|