2024-04-28 17:11:40 +04:00
|
|
|
@{
|
|
|
|
ViewData["Title"] = "Privacy Policy";
|
|
|
|
}
|
2024-04-30 17:03:49 +04:00
|
|
|
<div class="text-center">
|
2024-05-26 23:23:24 +04:00
|
|
|
<h2 class="display-4">Личные данные</h2>
|
2024-04-30 17:03:49 +04:00
|
|
|
</div>
|
2024-05-26 23:23:24 +04:00
|
|
|
<form id="clientForm" method="post">
|
|
|
|
<input type="text" name="id" id="id" value="@Model.Id" hidden="hidden"/>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-4">Логин:</div>
|
|
|
|
<div class="col-8">
|
|
|
|
<input type="text" name="login" id="login" value="@Model.Login" />
|
|
|
|
<span id="loginError" class="text-danger"></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-4">Почта:</div>
|
|
|
|
<div class="col-8">
|
|
|
|
<input type="email" name="email" id="email" value="@Model.Email" />
|
|
|
|
<span id="emailError" class="text-danger"></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-4">Пароль:</div>
|
|
|
|
<div class="col-8">
|
|
|
|
<input type="password" name="password" id="password" value="@Model.Password" />
|
|
|
|
<span id="passwordError" class="text-danger"></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-4">ФИО:</div>
|
|
|
|
<div class="col-8">
|
|
|
|
<input type="text" name="fio" id="fio" value="@Model.Name" />
|
|
|
|
<span id="fioError" class="text-danger"></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-8"></div>
|
|
|
|
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('#clientForm').submit(function(event) {
|
|
|
|
var login = $('#login').val();
|
|
|
|
var email = $('#email').val();
|
|
|
|
var password = $('#password').val();
|
|
|
|
var fio = $('#fio').val();
|
|
|
|
var isValid = true;
|
|
|
|
|
|
|
|
$('#loginError').text('');
|
|
|
|
$('#emailError').text('');
|
|
|
|
$('#passwordError').text('');
|
|
|
|
$('#fioError').text('');
|
|
|
|
|
|
|
|
// Валидация логина
|
|
|
|
if (login.length < 5 || login.length > 50) {
|
|
|
|
$('#loginError').text('Логин должен быть от 5 до 50 символов.');
|
|
|
|
isValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Валидация почты
|
|
|
|
var emailPattern = /^[a-zA-Z0-9._-]+@@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
|
|
|
|
if (!emailPattern.test(email)) {
|
|
|
|
$('#emailError').text('Неверный формат почты.');
|
|
|
|
isValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Валидация пароля
|
|
|
|
if (password.length < 8 || password.length > 20) {
|
|
|
|
$('#passwordError').text('Пароль должен быть от 8 до 20 символов.');
|
|
|
|
isValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Валидация ФИО
|
|
|
|
if (fio.length < 2 || fio.length > 20) {
|
|
|
|
$('#fioError').text('ФИО должно быть от 2 до 20 символов.');
|
|
|
|
isValid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isValid) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|