Удалено поле Phone
This commit is contained in:
parent
f69107d554
commit
85d72eaec0
1 changed files with 0 additions and 58 deletions
|
|
@ -69,20 +69,6 @@ import { SITE_URL } from '@constants';
|
||||||
<span class="error-message" id="email-error"></span>
|
<span class="error-message" id="email-error"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="phone">Телефон</label>
|
|
||||||
<input
|
|
||||||
type="tel"
|
|
||||||
id="phone"
|
|
||||||
name="phone"
|
|
||||||
placeholder="+7 (999) 000-00-00"
|
|
||||||
required
|
|
||||||
autocomplete="tel"
|
|
||||||
inputmode="tel"
|
|
||||||
/>
|
|
||||||
<span class="error-message" id="phone-error"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password">
|
<label for="password">
|
||||||
Пароль
|
Пароль
|
||||||
|
|
@ -847,7 +833,6 @@ import { SITE_URL } from '@constants';
|
||||||
const firstNameInput = document.getElementById('firstName') as HTMLInputElement;
|
const firstNameInput = document.getElementById('firstName') as HTMLInputElement;
|
||||||
const lastNameInput = document.getElementById('lastName') as HTMLInputElement;
|
const lastNameInput = document.getElementById('lastName') as HTMLInputElement;
|
||||||
const emailInput = document.getElementById('email') as HTMLInputElement;
|
const emailInput = document.getElementById('email') as HTMLInputElement;
|
||||||
const phoneInput = document.getElementById('phone') as HTMLInputElement;
|
|
||||||
const passwordInput = document.getElementById('password') as HTMLInputElement;
|
const passwordInput = document.getElementById('password') as HTMLInputElement;
|
||||||
const confirmPasswordInput = document.getElementById('confirmPassword') as HTMLInputElement;
|
const confirmPasswordInput = document.getElementById('confirmPassword') as HTMLInputElement;
|
||||||
|
|
||||||
|
|
@ -885,12 +870,6 @@ import { SITE_URL } from '@constants';
|
||||||
return regex.test(value);
|
return regex.test(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function validatePhone(value: string): boolean {
|
|
||||||
const cleaned = value.replace(/[\s\-\(\)]/g, '');
|
|
||||||
const regex = /^\+7\d{10}$/;
|
|
||||||
return regex.test(cleaned);
|
|
||||||
}
|
|
||||||
|
|
||||||
function validatePassword(value: string): boolean {
|
function validatePassword(value: string): boolean {
|
||||||
return value.length >= 8 && value.length <= 12;
|
return value.length >= 8 && value.length <= 12;
|
||||||
}
|
}
|
||||||
|
|
@ -940,37 +919,6 @@ import { SITE_URL } from '@constants';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
phoneInput?.addEventListener('focus', () => {
|
|
||||||
if (!phoneInput.value || !phoneInput.value.startsWith('+7')) {
|
|
||||||
phoneInput.value = '+7';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
phoneInput?.addEventListener('input', () => {
|
|
||||||
const digits = phoneInput.value.replace(/[^\d]/g, '');
|
|
||||||
const limitedDigits = digits.slice(0, 10);
|
|
||||||
let formatted = '+7';
|
|
||||||
if (limitedDigits.length > 0) {
|
|
||||||
formatted += ' ' + limitedDigits.slice(0, 3);
|
|
||||||
}
|
|
||||||
if (limitedDigits.length > 3) {
|
|
||||||
formatted += '-' + limitedDigits.slice(3, 6);
|
|
||||||
}
|
|
||||||
if (limitedDigits.length > 6) {
|
|
||||||
formatted += '-' + limitedDigits.slice(6, 8);
|
|
||||||
}
|
|
||||||
if (limitedDigits.length > 8) {
|
|
||||||
formatted += '-' + limitedDigits.slice(8, 10);
|
|
||||||
}
|
|
||||||
phoneInput.value = formatted;
|
|
||||||
|
|
||||||
if (phoneInput.value && !validatePhone(phoneInput.value)) {
|
|
||||||
showError(phoneInput, 'Введите 10 цифр номера');
|
|
||||||
} else {
|
|
||||||
clearError(phoneInput);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
passwordInput?.addEventListener('input', () => {
|
passwordInput?.addEventListener('input', () => {
|
||||||
if (passwordInput.value.length > 12) {
|
if (passwordInput.value.length > 12) {
|
||||||
passwordInput.value = passwordInput.value.slice(0, 12);
|
passwordInput.value = passwordInput.value.slice(0, 12);
|
||||||
|
|
@ -1005,7 +953,6 @@ import { SITE_URL } from '@constants';
|
||||||
const firstName = formData.get('firstName') as string;
|
const firstName = formData.get('firstName') as string;
|
||||||
const lastName = formData.get('lastName') as string;
|
const lastName = formData.get('lastName') as string;
|
||||||
const email = (formData.get('email') as string) || '';
|
const email = (formData.get('email') as string) || '';
|
||||||
const phone = formData.get('phone') as string;
|
|
||||||
const password = formData.get('password') as string;
|
const password = formData.get('password') as string;
|
||||||
const confirmPassword = formData.get('confirmPassword') as string;
|
const confirmPassword = formData.get('confirmPassword') as string;
|
||||||
|
|
||||||
|
|
@ -1032,11 +979,6 @@ import { SITE_URL } from '@constants';
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validatePhone(phone)) {
|
|
||||||
showError(phoneInput, 'Введите корректный номер телефона');
|
|
||||||
hasErrors = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!validatePassword(password)) {
|
if (!validatePassword(password)) {
|
||||||
showError(passwordInput, 'Пароль должен быть от 8 до 12 символов');
|
showError(passwordInput, 'Пароль должен быть от 8 до 12 символов');
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue