Commit ef73d19b1156015385ed358ab1c568f74b7afe6f
1 parent
a1df95236a
Exists in
master
worker/amployer recreate resistrations
Showing 7 changed files with 157 additions and 216 deletions Side-by-side Diff
app/Http/Controllers/EmployerController.php
... | ... | @@ -401,72 +401,66 @@ class EmployerController extends Controller |
401 | 401 | } |
402 | 402 | |
403 | 403 | // Регистрация работодателя |
404 | - public function register_employer(Request $request) { | |
405 | - $params = $request->all(); | |
406 | - | |
404 | + public function register_employer(Request $request) | |
405 | + { | |
407 | 406 | $rules = [ |
408 | - //'surname' => ['required', 'string', 'max:255'], | |
409 | - //'name_man' => ['required', 'string', 'max:255'], | |
410 | - 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | |
407 | + 'surname' => ['nullable', 'string', 'max:255'], | |
408 | + 'name_man' => ['nullable', 'string', 'max:255'], | |
409 | + 'email' => ['required', 'email', 'max:255', 'unique:users'], | |
411 | 410 | 'name_company' => ['required', 'string', 'max:255'], |
412 | 411 | 'password' => ['required', 'string', 'min:6'], |
412 | + 'password_confirmation' => ['required', 'same:password'], | |
413 | + 'politik' => ['required', 'accepted'], | |
413 | 414 | ]; |
414 | 415 | |
415 | 416 | $messages = [ |
416 | 417 | 'required' => 'Укажите обязательное поле', |
418 | + 'email' => 'Введите корректный email', | |
419 | + 'unique' => 'Email уже зарегистрирован', | |
420 | + 'same' => 'Пароль и подтверждение пароля не совпадают', | |
417 | 421 | 'min' => [ |
418 | - 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | |
419 | - 'integer' => 'Поле «:attribute» должно быть :min или больше', | |
420 | - 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | |
422 | + 'string' => 'Поле должно быть не менее :min символов', | |
421 | 423 | ], |
422 | 424 | 'max' => [ |
423 | - 'string' => 'Поле «:attribute» должно быть не больше :max символов', | |
424 | - 'integer' => 'Поле «:attribute» должно быть :max или меньше', | |
425 | - 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | |
426 | - ] | |
425 | + 'string' => 'Поле должно быть не более :max символов', | |
426 | + ], | |
427 | + 'accepted' => 'Необходимо согласиться с политикой конфиденциальности', | |
427 | 428 | ]; |
428 | 429 | |
429 | - $email = $request->get('email'); | |
430 | - if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | |
431 | - return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | |
432 | - } | |
430 | + $validator = Validator::make($request->all(), $rules, $messages); | |
433 | 431 | |
434 | - if ($request->get('password') !== $request->get('confirmed')){ | |
435 | - return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | |
432 | + if ($validator->fails()) { | |
433 | + return response()->json(['ERRORS' => $validator->errors()], 422); | |
436 | 434 | } |
437 | 435 | |
438 | - if (strlen($request->get('password')) < 6) { | |
439 | - return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | |
440 | - } | |
436 | + $params = $request->all(); | |
441 | 437 | |
442 | - if (empty($request->get('surname'))) { | |
438 | + if (empty($params['surname'])) { | |
443 | 439 | $params['surname'] = 'Неизвестно'; |
444 | 440 | } |
445 | - if (empty($request->get('name_man'))) { | |
441 | + if (empty($params['name_man'])) { | |
446 | 442 | $params['name_man'] = 'Неизвестно'; |
447 | 443 | } |
448 | - $validator = Validator::make($params, $rules, $messages); | |
449 | 444 | |
450 | - if ($validator->fails()) { | |
451 | - return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | |
452 | - } else { | |
453 | - $user = $this->create($params); | |
445 | + if ($user = $this->create($params)) { | |
454 | 446 | event(new Registered($user)); |
455 | 447 | |
456 | 448 | try { |
457 | 449 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); |
458 | 450 | } catch (Throwable $e) { |
459 | - Log::error($e); | |
451 | + Log::error('Ошибка при отправке письма: ' . $e->getMessage()); | |
460 | 452 | } |
461 | 453 | |
462 | 454 | Auth::guard()->login($user); |
463 | - } | |
464 | 455 | |
465 | - if ($user) { | |
466 | - return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | |
467 | - } else { | |
468 | - return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | |
456 | + return response()->json([ | |
457 | + 'REDIRECT' => route('employer.cabinet'), | |
458 | + ]); | |
469 | 459 | } |
460 | + | |
461 | + return response()->json([ | |
462 | + 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.', | |
463 | + ]); | |
470 | 464 | } |
471 | 465 | |
472 | 466 | // Создание пользователя |
app/Http/Controllers/WorkerController.php
... | ... | @@ -575,60 +575,47 @@ class WorkerController extends Controller |
575 | 575 | // Регистрация соискателя |
576 | 576 | public function register_worker(Request $request) |
577 | 577 | { |
578 | - $params = $request->all(); | |
579 | - $params['is_worker'] = 1; | |
580 | - | |
581 | 578 | $rules = [ |
582 | 579 | 'surname' => ['required', 'string', 'max:255'], |
583 | 580 | 'name_man' => ['required', 'string', 'max:255'], |
584 | 581 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
585 | - 'password' => ['required', 'string', 'min:6'] | |
582 | + 'password' => ['required', 'string', 'min:6'], | |
583 | + 'password_confirmation' => ['required', 'same:password'], | |
584 | + 'politik' => ['required', 'accepted'], | |
585 | + 'job_titles' => ['required', 'numeric'] | |
586 | 586 | ]; |
587 | 587 | |
588 | 588 | $messages = [ |
589 | 589 | 'required' => 'Укажите обязательное поле', |
590 | + 'email' => 'Введите корректный email', | |
591 | + 'unique' => 'Email уже зарегистрирован', | |
592 | + 'same' => 'Пароль и подтверждение пароля не совпадают', | |
590 | 593 | 'min' => [ |
591 | - 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | |
592 | - 'integer' => 'Поле «:attribute» должно быть :min или больше', | |
593 | - 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | |
594 | + 'string' => 'Поле должно быть не менее :min символов', | |
594 | 595 | ], |
595 | - 'max' => [ | |
596 | - 'string' => 'Поле «:attribute» должно быть не больше :max символов', | |
597 | - 'integer' => 'Поле «:attribute» должно быть :max или меньше', | |
598 | - 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | |
599 | - ] | |
596 | + 'accepted' => 'Необходимо согласиться с политикой конфиденциальности', | |
597 | + 'numeric' => 'Укажите обязательное поле', | |
600 | 598 | ]; |
601 | 599 | |
602 | - $email = $request->get('email'); | |
603 | - if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | |
604 | - return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | |
605 | - } | |
606 | - | |
607 | - if ($request->get('password') !== $request->get('confirmed')){ | |
608 | - return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | |
609 | - } | |
600 | + $validator = Validator::make($request->all(), $rules, $messages); | |
610 | 601 | |
611 | - if (strlen($request->get('password')) < 6) { | |
612 | - return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | |
602 | + if ($validator->fails()) { | |
603 | + return response()->json(['ERRORS' => $validator->errors()], 422); | |
613 | 604 | } |
614 | 605 | |
615 | - if (($request->has('politik')) && ($request->get('politik') == 1)) { | |
616 | - $validator = Validator::make($params, $rules, $messages); | |
617 | - | |
618 | - if ($validator->fails()) { | |
619 | - return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | |
620 | - } | |
621 | - | |
622 | - if ($user = $this->create($params)) { | |
623 | - event(new Registered($user)); | |
624 | - return json_encode(Array("REDIRECT" => redirect()->to('/')->getTargetUrl())); | |
625 | - } else { | |
626 | - return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | |
627 | - } | |
606 | + $params = $request->all(); | |
607 | + $params['is_worker'] = 1; | |
628 | 608 | |
629 | - } else { | |
630 | - return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | |
609 | + if ($user = $this->create($params)) { | |
610 | + event(new Registered($user)); | |
611 | + return response()->json([ | |
612 | + 'REDIRECT' => url('/') | |
613 | + ]); | |
631 | 614 | } |
615 | + | |
616 | + return response()->json([ | |
617 | + 'ERROR' => 'Произошла ошибка при регистрации. Попробуйте снова.' | |
618 | + ]); | |
632 | 619 | } |
633 | 620 | |
634 | 621 | // Звездная оценка и ответ |
public/css/general.css
resources/views/js/captha.blade.php
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | if (document.getElementById("cpatchaTextBox").value == code) { |
69 | 69 | console.log('Валидная капча 1!'); |
70 | 70 | }else{ |
71 | - alert("Неверная капча! Повторите вновь"); | |
71 | + // alert("Неверная капча! Повторите вновь"); | |
72 | 72 | createCaptcha(); |
73 | 73 | } |
74 | 74 | } |
... | ... | @@ -77,7 +77,7 @@ |
77 | 77 | if (document.getElementById("cpatchaTextBox2").value == code2) { |
78 | 78 | console.log('Валидная капча 2!'); |
79 | 79 | }else{ |
80 | - alert("Неверная капча! Повторите вновь"); | |
80 | + // alert("Неверная капча! Повторите вновь"); | |
81 | 81 | createCaptcha(); |
82 | 82 | } |
83 | 83 | } |
... | ... | @@ -111,6 +111,7 @@ |
111 | 111 | form2.addEventListener('submit', function (event) { |
112 | 112 | if (document.getElementById("cpatchaTextBox2").value == code2) { |
113 | 113 | console.log('Валидный кот'); |
114 | + $('#captcha_employer_error').text(''); | |
114 | 115 | return true; |
115 | 116 | } else { |
116 | 117 | console.log('Ошибка2'); |
resources/views/js/modals.blade.php
... | ... | @@ -170,79 +170,43 @@ |
170 | 170 | }); |
171 | 171 | }); |
172 | 172 | |
173 | - $(document).on('click', '#button_reg_worker', function() { | |
174 | - $('#messages_error_reg').html(''); | |
175 | - | |
176 | - var field_login = $('#email_worker'); | |
177 | - var field_pwd = $('#password_worker'); | |
178 | - var field_confirm_pwd = $('#password_confirmation_worker'); | |
179 | - var field_politik_worker = $('#politik'); | |
180 | - var field_telephone_worker = $('#telephone_worker'); | |
181 | - var field_job_titles_worker = $('#job_titles_worker'); | |
182 | - var field_surname_worker = $('#surname_worker'); | |
183 | - var field_name_man = $('#name_man_worker'); | |
184 | - var field_surname2_worker = $('#surname2_worker'); | |
185 | - | |
186 | - var login = field_login.val(); | |
187 | - var pwd = field_pwd.val(); | |
188 | - var confirm_pwd = field_confirm_pwd.val(); | |
189 | - var politik = field_politik_worker.val(); | |
190 | - var telephone = field_telephone_worker.val(); | |
191 | - var job_titles = field_job_titles_worker.val(); | |
192 | - var surname = field_surname_worker.val(); | |
193 | - var name_man = field_name_man.val(); | |
194 | - var surname2 = field_surname2_worker.val(); | |
195 | - | |
173 | + $('#form1').on('submit', function (e) { | |
174 | + e.preventDefault(); | |
196 | 175 | |
197 | 176 | if (document.getElementById("cpatchaTextBox1").value == code) { |
198 | - console.log('Валидный кот'); | |
199 | - | |
177 | + console.log('Валидная капча'); | |
200 | 178 | } else { |
201 | - console.log('Ошибка1'); | |
202 | - event.preventDefault(); | |
203 | - $('#block-info').css({'display': 'block'}); | |
204 | - $('#messages_error_reg').html('ERROR: Капча неверная!'); | |
205 | - | |
179 | + $('#captcha_error').text('Капча неверная!'); | |
206 | 180 | return false; |
207 | 181 | } |
208 | 182 | |
209 | - if (!document.getElementById('politik').checked) { | |
210 | - event.preventDefault(); | |
211 | - $('#block-info').css({'display': 'block'}); | |
212 | - $('#messages_error_reg').html('ERROR: Вы не согласились с политикой конфидициальности!'); | |
213 | - return false; | |
214 | - } | |
183 | + $('.error-message').text(''); | |
184 | + | |
185 | + let formData = $(this).serialize(); | |
215 | 186 | |
216 | 187 | $.ajax({ |
217 | - type: "GET", | |
218 | - url: "{{ route('register_worker') }}", | |
219 | - data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+ | |
220 | - "&telephone="+telephone+"&job_titles="+job_titles+"&surname="+surname+"&name_man="+name_man+ | |
221 | - "&surname2="+surname2+"&subscribe_email="+login, | |
222 | - success: function (data) { | |
223 | - let d = JSON.parse(data); | |
224 | - if (typeof d['REDIRECT'] !== "undefined") { | |
188 | + url: $(this).attr('action'), | |
189 | + method: $(this).attr('method'), | |
190 | + data: formData, | |
191 | + success: function (response) { | |
192 | + if (response.REDIRECT) { | |
225 | 193 | successfulRegistrationWorker() |
226 | 194 | } |
227 | - | |
228 | - if (typeof d['ERROR'] !== "undefined") { | |
229 | - console.log(d['ERROR']); | |
230 | - $('#block-info').css({'display': 'block'}); | |
231 | - $('#messages_error_reg').html(d['ERROR']); | |
232 | - } | |
233 | - console.log(d['REDIRECT']); | |
234 | - | |
235 | - }, | |
236 | - headers: { | |
237 | - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
238 | 195 | }, |
239 | - error: function (data) { | |
240 | - data = JSON.stringify(data); | |
241 | - console.log('Error: ' + data); | |
196 | + error: function (jqXHR) { | |
197 | + if (jqXHR.status === 422) { | |
198 | + let errors = jqXHR.responseJSON.ERRORS; | |
199 | + | |
200 | + for (let field in errors) { | |
201 | + if (errors.hasOwnProperty(field)) { | |
202 | + $('#' + field + '_error').text(errors[field][0]); | |
203 | + } | |
204 | + } | |
205 | + } else { | |
206 | + alert('Произошла ошибка при регистрации. Попробуйте снова.'); | |
207 | + } | |
242 | 208 | } |
243 | 209 | }); |
244 | - | |
245 | - return false; | |
246 | 210 | }); |
247 | 211 | |
248 | 212 | $(document).on('click', '.open-login-modal', function(e) { |
... | ... | @@ -255,76 +219,42 @@ |
255 | 219 | }); |
256 | 220 | }); |
257 | 221 | |
258 | - $(document).on('click', '#button_reg_employer', function() { | |
259 | - | |
260 | - $('#messages_error_reg').html(''); | |
261 | - | |
262 | - var field_login = $('#email_employer'); | |
263 | - var field_pwd = $('#password_employer'); | |
264 | - var field_confirm_pwd = $('#password_confirmation_employer'); | |
265 | - var field_politik_employer = $('#politik_employer'); | |
266 | - var field_telephone_employer = $('#telephone_employer'); | |
267 | - var field_company_employer = $('#company_employer'); | |
268 | - var field_surname_employer = $('#surname_employer'); | |
269 | - var field_name_man_employer = $('#name_man_employer'); | |
270 | - var field_surname2_employer = $('#surname2_employer'); | |
271 | - | |
272 | - var login = field_login.val(); | |
273 | - var pwd = field_pwd.val(); | |
274 | - var confirm_pwd = field_confirm_pwd.val(); | |
275 | - var politik = field_politik_employer.val(); | |
276 | - var telephone = field_telephone_employer.val(); | |
277 | - var company_employer = field_company_employer.val(); | |
278 | - var surname = field_surname_employer.val(); | |
279 | - var name_man = field_name_man_employer.val(); | |
280 | - var surname2 = field_surname2_employer.val(); | |
222 | + $('#form2').on('submit', function (e) { | |
223 | + e.preventDefault(); | |
281 | 224 | |
282 | 225 | if (document.getElementById("cpatchaTextBox2").value == code2) { |
283 | - console.log('Валидный кот'); | |
284 | - | |
226 | + console.log('Валидная капча'); | |
285 | 227 | } else { |
286 | - console.log('Ошибка2'); | |
287 | - event.preventDefault(); | |
288 | - $('#block-info').css({'display': 'block'}); | |
289 | - $('#messages_error_reg').html('ERROR: Капча неверная!'); | |
228 | + $('#captcha_employer_error').text('Капча неверная!'); | |
290 | 229 | return false; |
291 | 230 | } |
292 | 231 | |
293 | - console.log('login: '+login+' password: '+pwd); | |
294 | - if (!document.getElementById('politik_employer').checked) { | |
295 | - event.preventDefault(); | |
296 | - $('#block-info').css({'display': 'block'}); | |
297 | - $('#messages_error_reg').html('ERROR: Вы не согласились с политикой конфидициальности!'); | |
298 | - return false; | |
299 | - } | |
232 | + $('.employer_error-message').text(''); | |
233 | + | |
234 | + let formData = $(this).serialize(); | |
300 | 235 | |
301 | 236 | $.ajax({ |
302 | - type: "GET", | |
303 | - url: "{{ route('register_employer') }}", | |
304 | - data: "email="+login+"&password="+pwd+"&confirmed="+confirm_pwd+"&politik="+politik+ | |
305 | - "&telephone="+telephone+"&name_company="+company_employer+"&surname="+surname+"&name_man="+name_man+ | |
306 | - "&surname2="+surname2+"&subscribe_email="+login, | |
307 | - success: function (data) { | |
308 | - console.log('Вход в систему'); | |
309 | - let d = JSON.parse(data); | |
310 | - if(typeof d['REDIRECT'] !== "undefined") { | |
311 | - successfulRegistrationEmployer() | |
312 | - } | |
313 | - if (typeof d['ERROR'] !== "undefined") { | |
314 | - console.log(d['ERROR']); | |
315 | - $('#block-info').css({'display': 'block'}); | |
316 | - $('#messages_error_reg').html(d['ERROR']); | |
237 | + url: $(this).attr('action'), | |
238 | + method: $(this).attr('method'), | |
239 | + data: formData, | |
240 | + success: function (response) { | |
241 | + if (response.REDIRECT) { | |
242 | + successfulRegistrationEmployer(); | |
317 | 243 | } |
318 | - console.log(d['REDIRECT']); | |
319 | - }, | |
320 | - headers: { | |
321 | - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
322 | 244 | }, |
323 | - error: function (data) { | |
324 | - data = JSON.stringify(data); | |
325 | - console.log('Error: ' + data); | |
245 | + error: function (jqXHR) { | |
246 | + if (jqXHR.status === 422) { | |
247 | + let errors = jqXHR.responseJSON.ERRORS; | |
248 | + | |
249 | + for (let field in errors) { | |
250 | + if (errors.hasOwnProperty(field)) { | |
251 | + $('#' + field + '_employer_error').text(errors[field][0]); | |
252 | + } | |
253 | + } | |
254 | + } else { | |
255 | + alert('Произошла ошибка при регистрации. Попробуйте снова.'); | |
256 | + } | |
326 | 257 | } |
327 | 258 | }); |
328 | - return false; | |
329 | 259 | }); |
330 | 260 | </script> |
resources/views/modals/register.blade.php
... | ... | @@ -24,19 +24,22 @@ |
24 | 24 | <button type="button" class="modal__tabs-item button button_light active" data-tab="1">Кандидат</button> |
25 | 25 | <button type="button" class="modal__tabs-item button button_light" data-tab="2">Работодатель</button> |
26 | 26 | </div> |
27 | - <div class="modal__reg showed" data-body="1" id="form1" name="form1" onsubmit="-validateCaptcha()"> | |
27 | + <form class="modal__reg showed" data-body="1" id="form1" name="form1" onsubmit="return validateCaptcha()" method="POST" action="{{ route('register_worker') }}"> | |
28 | + @csrf | |
28 | 29 | <input type="hidden" name="is_worker" id="is_worker" value="1"/> |
30 | + | |
29 | 31 | <div class="modal__reg-item form-group"> |
30 | 32 | <label class="form-group__label">Электронная почта *</label> |
31 | 33 | <div class="form-group__item"> |
32 | - <input type="email" id="email_worker" name="email_worker" class="input" placeholder="info@rekamore.su" required> | |
34 | + <input type="email" id="email_worker" name="email" class="input" placeholder="info@rekamore.su"> | |
35 | + <span id="email_error" class="error-message"></span> | |
33 | 36 | </div> |
34 | 37 | </div> |
35 | 38 | |
36 | 39 | <div class="modal__reg-item form-group"> |
37 | 40 | <label class="form-group__label">Пароль *</label> |
38 | 41 | <div class="form-group__item"> |
39 | - <input type="password" id="password_worker" name="password_worker" class="input" placeholder="**********" required> | |
42 | + <input type="password" id="password_worker" name="password" class="input" placeholder="**********"> | |
40 | 43 | <button type="button" class="eye"> |
41 | 44 | <svg class="js-password-show"> |
42 | 45 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
... | ... | @@ -45,13 +48,14 @@ |
45 | 48 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> |
46 | 49 | </svg> |
47 | 50 | </button> |
51 | + <span id="password_error" class="error-message"></span> | |
48 | 52 | </div> |
49 | 53 | </div> |
50 | 54 | |
51 | 55 | <div class="modal__reg-item form-group"> |
52 | 56 | <label class="form-group__label">Подтвердить пароль *</label> |
53 | 57 | <div class="form-group__item"> |
54 | - <input type="password" name="password_confirmation_worker" id="password_confirmation_worker" class="input" placeholder="**********" required> | |
58 | + <input type="password" id="password_confirmation_worker" name="password_confirmation" class="input" placeholder="**********"> | |
55 | 59 | <button type="button" class="eye"> |
56 | 60 | <svg class="js-password-show"> |
57 | 61 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
... | ... | @@ -61,26 +65,29 @@ |
61 | 65 | </svg> |
62 | 66 | </button> |
63 | 67 | </div> |
68 | + <span id="password_confirmation_error" class="error-message"></span> | |
64 | 69 | </div> |
65 | 70 | |
66 | 71 | <div class="modal__reg-item form-group"> |
67 | 72 | <label class="form-group__label">Фамилия *</label> |
68 | 73 | <div class="form-group__item"> |
69 | - <input type="text" id="surname_worker" name="surname_worker" class="input" placeholder="Шестаков" required> | |
74 | + <input type="text" id="surname_worker" name="surname" class="input" placeholder="Шестаков"> | |
75 | + <span id="surname_error" class="error-message"></span> | |
70 | 76 | </div> |
71 | 77 | </div> |
72 | 78 | |
73 | 79 | <div class="modal__reg-item form-group"> |
74 | 80 | <label class="form-group__label">Имя *</label> |
75 | 81 | <div class="form-group__item"> |
76 | - <input type="text" id="name_man_worker" name="name_man_worker" class="input" placeholder="Андрей" required> | |
82 | + <input type="text" id="name_man_worker" name="name_man" class="input" placeholder="Андрей"> | |
83 | + <span id="name_man_error" class="error-message"></span> | |
77 | 84 | </div> |
78 | 85 | </div> |
79 | 86 | |
80 | 87 | <div class="modal__reg-item form-group"> |
81 | 88 | <label class="form-group__label">Отчество</label> |
82 | 89 | <div class="form-group__item"> |
83 | - <input type="text" id="surname2_worker" name="surname2_worker" class="input" placeholder="Васильевич"> | |
90 | + <input type="text" id="surname2_worker" name="surname2" class="input" placeholder="Васильевич"> | |
84 | 91 | </div> |
85 | 92 | </div> |
86 | 93 | <!-- |
... | ... | @@ -95,7 +102,7 @@ |
95 | 102 | <label class="form-group__label">Должность</label> |
96 | 103 | <div class="form-group__item"> |
97 | 104 | <div class="select"> |
98 | - <select class="js-select2" name="job_titles_worker" id="job_titles_worker"> | |
105 | + <select class="js-select2" name="job_titles" id="job_titles_worker"> | |
99 | 106 | <option selected>Не указано</option> |
100 | 107 | @if ($Job_titles->count()) |
101 | 108 | @foreach($Job_titles as $it) |
... | ... | @@ -103,6 +110,7 @@ |
103 | 110 | @endforeach |
104 | 111 | @endif |
105 | 112 | </select> |
113 | + <span id="job_titles_error" class="error-message"></span> | |
106 | 114 | </div> |
107 | 115 | </div> |
108 | 116 | </div> |
... | ... | @@ -110,7 +118,8 @@ |
110 | 118 | <div class="modal__reg-item form-group"> |
111 | 119 | <label class="form-group__label">Номер телефона</label> |
112 | 120 | <div class="form-group__item"> |
113 | - <input type="tel" name="telephone_worker" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__" required> | |
121 | + <input type="tel" name="telephone" id="telephone_worker" class="input" placeholder="+7 (___) ___-__-__"> | |
122 | + <span id="telephone_error" class="error-message"></span> | |
114 | 123 | </div> |
115 | 124 | </div> |
116 | 125 | <!--<div class="modal__reg-item"> |
... | ... | @@ -121,6 +130,7 @@ |
121 | 130 | <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox1" style="width: 100%"/> |
122 | 131 | |
123 | 132 | <div class="modal__reg-item"> |
133 | + <span id="captcha_error" class="error-message"></span> | |
124 | 134 | <label class="checkbox"> |
125 | 135 | <input type="checkbox" name="politik" id="politik" value="1" class="checkbox__input"> |
126 | 136 | <span class="checkbox__icon"> |
... | ... | @@ -134,21 +144,24 @@ |
134 | 144 | </span> |
135 | 145 | </span> |
136 | 146 | </label> |
147 | + <span id="politik_error" class="error-message"></span> | |
137 | 148 | </div> |
138 | 149 | <button type="submit" id="button_reg_worker" name="button_reg_worker" class="button">Зарегистрироваться</button> |
139 | - </div> | |
150 | + </form> | |
140 | 151 | |
141 | - <div class="modal__reg" data-body="2" id="form2" name="name2" onsubmit="_validateCaptcha2()"> | |
152 | + <form class="modal__reg" data-body="2" id="form2" name="name2" onsubmit="return validateCaptcha2()" method="POST" action="{{ route('register_employer') }}"> | |
153 | + @csrf | |
142 | 154 | <div class="modal__reg-item form-group"> |
143 | 155 | <label class="form-group__label">Электронная почта *</label> |
144 | 156 | <div class="form-group__item"> |
145 | - <input type="email" id="email_employer" name="email_employer" class="input" placeholder="info@rekamore.su" required> | |
157 | + <input type="email" id="email_employer" name="email" class="input" placeholder="info@rekamore.su"> | |
158 | + <span id="email_employer_error" class="employer_error-message"></span> | |
146 | 159 | </div> |
147 | 160 | </div> |
148 | 161 | <div class="modal__reg-item form-group"> |
149 | 162 | <label class="form-group__label">Пароль *</label> |
150 | 163 | <div class="form-group__item"> |
151 | - <input type="password" id="password_employer" name="password_employer" class="input" placeholder="**********" required> | |
164 | + <input type="password" id="password_employer" name="password" class="input" placeholder="**********"> | |
152 | 165 | <button type="button" class="eye"> |
153 | 166 | <svg class="js-password-show"> |
154 | 167 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
... | ... | @@ -157,12 +170,13 @@ |
157 | 170 | <use xlink:href="{{ asset('images/sprite.svg#eye-2') }}"></use> |
158 | 171 | </svg> |
159 | 172 | </button> |
173 | + <span id="password_employer_error" class="employer_error-message"></span> | |
160 | 174 | </div> |
161 | 175 | </div> |
162 | 176 | <div class="modal__reg-item form-group"> |
163 | 177 | <label class="form-group__label">Подтвердить пароль *</label> |
164 | 178 | <div class="form-group__item"> |
165 | - <input type="password" id="password_confirmation_employer" name="password_confirmation_employer" class="input" placeholder="**********" required> | |
179 | + <input type="password" id="password_confirmation_employer" name="password_confirmation" class="input" placeholder="**********"> | |
166 | 180 | <button type="button" class="eye"> |
167 | 181 | <svg class="js-password-show"> |
168 | 182 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
... | ... | @@ -172,41 +186,44 @@ |
172 | 186 | </svg> |
173 | 187 | </button> |
174 | 188 | </div> |
189 | + <span id="password_confirmation_employer_error" class="employer_error-message"></span> | |
175 | 190 | </div> |
176 | 191 | |
177 | 192 | |
178 | 193 | <div class="modal__reg-item form-group"> |
179 | 194 | <label class="form-group__label">Фамилия работодателя *</label> |
180 | 195 | <div class="form-group__item"> |
181 | - <input type="text" id="surname_employer" name="surname_employer" class="input" placeholder="Шестаков" required> | |
196 | + <input type="text" id="surname_employer" name="surname" class="input" placeholder="Шестаков"> | |
197 | + <span id="surname_employer_error" class="employer_error-message"></span> | |
182 | 198 | </div> |
183 | 199 | </div> |
184 | 200 | |
185 | 201 | <div class="modal__reg-item form-group"> |
186 | 202 | <label class="form-group__label">Имя работодателя *</label> |
187 | 203 | <div class="form-group__item"> |
188 | - <input type="text" id="name_man_employer" name="name_man_employer" class="input" placeholder="Андрей" required> | |
204 | + <input type="text" id="name_man_employer" name="name_man" class="input" placeholder="Андрей"> | |
189 | 205 | </div> |
190 | 206 | </div> |
191 | 207 | |
192 | 208 | <div class="modal__reg-item form-group"> |
193 | 209 | <label class="form-group__label">Отчество работодателя</label> |
194 | 210 | <div class="form-group__item"> |
195 | - <input type="text" id="surname2_employer" name="surname2_employer" class="input" placeholder="Васильевич"> | |
211 | + <input type="text" id="surname2_employer" name="surname2" class="input" placeholder="Васильевич"> | |
196 | 212 | </div> |
197 | 213 | </div> |
198 | 214 | |
199 | 215 | <div class="modal__reg-item form-group"> |
200 | 216 | <label class="form-group__label">Название судоходной компании *</label> |
201 | 217 | <div class="form-group__item"> |
202 | - <input type="text" name="company_employer" id="company_employer" class="input" placeholder="ООО Река Море" required> | |
218 | + <input type="text" name="name_company" id="name_company_employer" class="input" placeholder="ООО Река Море"> | |
219 | + <span id="name_company_employer_error" class="employer_error-message"></span> | |
203 | 220 | </div> |
204 | 221 | </div> |
205 | 222 | |
206 | 223 | <div class="modal__reg-item form-group"> |
207 | 224 | <label class="form-group__label">Номер телефона</label> |
208 | 225 | <div class="form-group__item"> |
209 | - <input type="tel" name="telephone_employer" id="telephone_employer" class="input" placeholder="+7 (___) ___-__-__" required> | |
226 | + <input type="tel" name="telephone" id="telephone_employer" class="input" placeholder="+7 (___) ___-__-__"> | |
210 | 227 | </div> |
211 | 228 | </div> |
212 | 229 | <!--<div class="modal__reg-item"> |
... | ... | @@ -218,8 +235,9 @@ |
218 | 235 | <input type="text" placeholder="Captcha" class="input registr-form__input" id="cpatchaTextBox2" style="width: 100%"/> |
219 | 236 | |
220 | 237 | <div class="modal__reg-item"> |
238 | + <span id="captcha_employer_error" class="employer_error-message"></span> | |
221 | 239 | <label class="checkbox"> |
222 | - <input type="checkbox" name="politik_employer" id="politik_employer" value="1" class="checkbox__input" required> | |
240 | + <input type="checkbox" name="politik" id="politik_employer" value="1" class="checkbox__input"> | |
223 | 241 | <span class="checkbox__icon"> |
224 | 242 | <svg> |
225 | 243 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> |
... | ... | @@ -231,9 +249,10 @@ |
231 | 249 | </span> |
232 | 250 | </span> |
233 | 251 | </label> |
252 | + <span id="politik_employer_error" class="employer_error-message"></span> | |
234 | 253 | </div> |
235 | 254 | <button type="submit" id="button_reg_employer" name="button_reg_employer" class="button">Зарегистрироваться</button> |
236 | - </div> | |
255 | + </form> | |
237 | 256 | <div class="modal__text"> |
238 | 257 | <span>Вспомнили пароль?</span> |
239 | 258 | |
routes/web.php
... | ... | @@ -441,8 +441,8 @@ Route::get('login', [MainController::class, 'input_login'])->name('login'); |
441 | 441 | // Выход из кабинета |
442 | 442 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); |
443 | 443 | |
444 | -Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); | |
445 | -Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); | |
444 | +Route::post( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); | |
445 | +Route::post('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); | |
446 | 446 | |
447 | 447 | //восстановление пароля |
448 | 448 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); |