modified: main_dc/nginx/nginx-ssl.conf

modified:   main_dc/yalarba/easySite/easySite/app/pages/auth/register.vue
new register and set nginx-ssh.conf easysiste.ru api to 8088 port
This commit is contained in:
2025-11-13 05:58:49 +05:00
parent c5b80129d3
commit 9cdad0902f
2 changed files with 118 additions and 44 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ server {
# Новый блок для API
location /api/ {
proxy_pass http://api_es:8081/api/;
proxy_pass http://api_es:8088/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -6,62 +6,51 @@
<div class="card-header text-center">
<h1 class="auth-title">Регистрация</h1>
</div>
<div class="card-body">
<form @submit.prevent="handleSubmit" class="auth-form">
<div class="form-group">
<label class="form-label">Имя</label>
<input
v-model="form.name"
type="text"
class="form-input"
placeholder="Ваше имя"
required
>
<label class="form-label">Полное имя</label>
<input v-model="form.full_name" type="text" class="form-input" placeholder="Ваше полное имя" required>
</div>
<div class="form-group">
<label class="form-label">Email</label>
<input
v-model="form.email"
type="email"
class="form-input"
placeholder="your@email.com"
required
>
<input v-model="form.email" type="email" class="form-input" placeholder="your@email.com" required>
</div>
<div class="form-group">
<label class="form-label">Телефон</label>
<input v-model="form.phone" type="tel" class="form-input" placeholder="Ваш телефон">
</div>
<div class="form-group">
<label class="form-label">Город</label>
<input v-model="form.city" type="text" class="form-input" placeholder="Ваш город">
</div>
<div class="form-group">
<label class="form-label">Пароль</label>
<input
v-model="form.password"
type="password"
class="form-input"
placeholder="Придумайте пароль"
required
>
<input v-model="form.password" type="password" class="form-input"
placeholder="Придумайте пароль (минимум 6 символов)" required minlength="6">
</div>
<div class="form-group">
<label class="form-label">Подтверждение пароля</label>
<input
v-model="form.passwordConfirm"
type="password"
class="form-input"
placeholder="Повторите пароль"
required
>
<input v-model="form.passwordConfirm" type="password" class="form-input" placeholder="Повторите пароль"
required minlength="6">
</div>
<button type="submit" class="btn btn-primary auth-button">
Зарегистрироваться
<button type="submit" class="btn btn-primary auth-button" :disabled="loading">
<span v-if="loading">Регистрация...</span>
<span v-else>Зарегистрироваться</span>
</button>
</form>
</div>
<div class="card-footer text-center">
<p class="auth-footer-text">
Уже есть аккаунт?
Уже есть аккаунт?
<NuxtLink to="/auth/login" class="auth-link">
Войдите
</NuxtLink>
@@ -77,22 +66,77 @@
</template>
<script setup lang="ts">
const config = useRuntimeConfig()
const loading = ref(false)
// Форма регистрации согласно UserRegisterRequest
const form = ref({
name: '',
full_name: '',
email: '',
password: '',
passwordConfirm: ''
passwordConfirm: '',
phone: '',
city: ''
})
const handleSubmit = () => {
const handleSubmit = async () => {
// Валидация паролей
if (form.value.password !== form.value.passwordConfirm) {
alert('Пароли не совпадают')
return
}
// В демо-режиме просто переходим в профиль
alert('Демо-режим: регистрация выполнена')
navigateTo('/profile')
// Проверка минимальной длины пароля
if (form.value.password.length < 6) {
alert('Пароль должен содержать минимум 6 символов')
return
}
loading.value = true
try {
// Отправка данных на бэкенд
const response = await $fetch(`https://easysite102.ru/auth/register`, {
method: 'POST',
body: {
email: form.value.email,
password: form.value.password,
full_name: form.value.full_name,
phone: form.value.phone || '', // optional field
city: form.value.city || '' // optional field
}
})
console.debug("response from fetch: %s", response)
// Успешная регистрация
alert('Регистрация выполнена успешно!')
// Автоматический вход после регистрации или переход на страницу входа
navigateTo('/auth/login')
} catch (error: unknown) {
console.error('Ошибка регистрации:', error)
if (error instanceof Error) {
if ('status' in error) {
const fetchError = error as { status?: number }
if (fetchError.status === 409) {
alert('Пользователь с таким email уже существует')
return
} else if (fetchError.status === 400) {
alert('Неверные данные для регистрации')
return
}
}
// Общее сообщение об ошибке
alert(`Ошибка: ${error.message}`)
} else {
alert('Неизвестная ошибка при регистрации. Попробуйте позже.')
}
} finally {
loading.value = false
}
}
</script>
@@ -132,6 +176,11 @@ const handleSubmit = () => {
margin-top: 0.5rem;
}
.auth-button:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.auth-footer-text {
color: var(--text-secondary);
margin-bottom: 1rem;
@@ -151,4 +200,29 @@ const handleSubmit = () => {
display: inline-block;
margin-top: 0.5rem;
}
.form-input {
width: 100%;
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: 0.375rem;
font-size: 1rem;
}
.form-input:focus {
outline: none;
border-color: var(--primary-500);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--text-primary);
}
.form-group {
margin-bottom: 1rem;
}
</style>