|
@@ -199,6 +199,13 @@ class UserController extends Controller
|
|
|
// return Redirect::back()->withErrors(trans('common.update_action', ['action' => trans('common.failed_code')]));
|
|
|
// }
|
|
|
|
|
|
+ $email = $data['newemail'];
|
|
|
+ $pattern = "/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/";
|
|
|
+
|
|
|
+ if (!preg_match($pattern, $email)) {
|
|
|
+ return Redirect::back()->withErrors(trans('common.update_action', ['action' => trans('common.error_email')]));
|
|
|
+ }
|
|
|
+
|
|
|
if ( User::where('email', $data['newemail'])->count() >= 1) {
|
|
|
return Redirect::back()->withErrors(trans('common.update_action', ['action' => trans('common.failed_email')]));
|
|
|
}
|