<?php
if (is_customer()) {
go(url('hesabim'));
}
if (is_post()) {
csrf_check();
$form = ['name' => post('name', ''), 'email' => post('email', ''), 'phone' => post('phone', ''), 'password' => post('password', '')];
$error = match (true) {
$form['name'] === '' => 'Ad soyad zorunlu.',
!filter_var($form['email'], FILTER_VALIDATE_EMAIL) => 'Geçerli bir e-posta girin.',
email_taken($form['email']) => 'Bu e-posta ile kayıtlı bir hesap var. Giriş yapmayı deneyin.',
mb_strlen($form['password']) < 8 => 'Şifre en az 8 karakter olmalı.',
!checked('kvkk') => 'Devam etmek için aydınlatma metnini onaylayın.',
default => null,
};
if ($error) {
reply(false, $error, [], url('kayit'));
}
customer_register($form);
finish('Hesabınız oluşturuldu, hoş geldiniz!', after_login_url());
}
auth_header('Üye ol');
?>
<h1 class="font-display text-3xl font-semibold tracking-tight text-ink">Hesap oluşturun</h1>
<p class="mt-2 text-sm text-zinc-500">Zaten üye misiniz? <a href="<?= url('giris') ?>" class="font-semibold text-ink underline underline-offset-4">Giriş yapın</a></p>
<form method="post" action="<?= url('kayit') ?>" data-ajax class="mt-10 space-y-5">
<?= csrf_field() ?>
<div>
<label class="label">Ad soyad</label>
<input name="name" class="input" autocomplete="name" required>
</div>
<div class="grid gap-5 sm:grid-cols-2">
<div>
<label class="label">E-posta</label>
<input name="email" type="email" class="input" autocomplete="email" required>
</div>
<div>
<label class="label">Telefon <span class="font-normal text-zinc-400">(isteğe bağlı)</span></label>
<input name="phone" type="tel" class="input" autocomplete="tel">
</div>
</div>
<div>
<label class="label">Şifre</label>
<input name="password" type="password" minlength="8" class="input" autocomplete="new-password" placeholder="En az 8 karakter" required>
</div>
<label class="flex cursor-pointer items-start gap-3 text-[13px] leading-5 text-zinc-600">
<input type="checkbox" name="kvkk" value="1" class="mt-0.5 size-4 shrink-0 rounded accent-ink" required>
<span>Kişisel verilerimin işlenmesine ilişkin aydınlatma metnini okudum.</span>
</label>
<button class="btn-primary w-full py-3.5">Üye ol</button>
</form>
<?php auth_footer() ?>
Lisans bilgisi projenin LICENSE dosyasında.