Parola Sıfırlama ve E-posta Doğrulama
Kullanıcıların erişimi güvenle geri kazanabilmesi için tek kullanımlık belirteçler, süre sonu ve işlemsel e-posta kullanarak güvenli hesap kurtarma ve e-posta doğrulama akışları oluşturun.
Parola Sıfırlama ve E-posta Doğrulama, CoddyKit'te ücretsiz bir AI Powered SaaS: Stripe + Auth + Billing + Deploy dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, AI Powered SaaS: Stripe + Auth + Billing + Deploy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. AI Powered SaaS: Stripe + Auth + Billing + Deploy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Why Reset & Verify?
Users forget passwords and mistype emails. A safe password reset flow lets them recover without support, and email verification confirms the address really belongs to them, cutting spam and fake accounts.
The Token Strategy
Both flows rely on a one-time token: a random, unguessable string emailed to the user. Possessing it proves control of the inbox.
import crypto from 'crypto';
const token = crypto.randomBytes(32).toString('hex');Storing the Token Hashed
Never store the raw token. Hash it before saving so a database leak cannot be used to reset accounts. Compare hashes when the user returns.
const hash = crypto.createHash('sha256').update(token).digest('hex');
await prisma.resetToken.create({
data: { userId, hash, expiresAt }
});Adding Expiry
Tokens must expire — usually 15 to 60 minutes. Store an expiresAt timestamp and reject tokens past it.
const expiresAt = new Date(Date.now() + 30 * 60 * 1000);Requesting a Reset
The user submits their email. Generate a token, save its hash, and email a link containing the raw token. Always respond the same way to avoid leaking which emails exist.
const link = process.env.APP_URL + '/reset?token=' + token;
await sendEmail(email, 'Reset your password', link);Sending Transactional Email
Use a provider like Resend or SendGrid for reliable delivery. Keep the message short with a clear single action.
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
await resend.emails.send({ to, subject, html });Verifying the Token
When the user opens the link, hash the incoming token, look it up, and check it is unused and unexpired.
const hash = crypto.createHash('sha256').update(token).digest('hex');
const record = await prisma.resetToken.findFirst({
where: { hash, expiresAt: { gt: new Date() }, usedAt: null }
});Updating the Password
If valid, hash the new password and save it, then mark the token used so it cannot be replayed.
const pw = await bcrypt.hash(newPassword, 12);
await prisma.user.update({ where: { id: record.userId }, data: { password: pw } });
await prisma.resetToken.update({ where: { id: record.id }, data: { usedAt: new Date() } });Email Verification Flow
Verification works the same way: on signup, email a token. When clicked, set emailVerified on the user and invalidate the token.
await prisma.user.update({
where: { id }, data: { emailVerified: new Date() }
});Preventing Abuse
Protect these endpoints:
- Rate limit reset requests
- Give identical responses for known and unknown emails
- Allow only one active token per user
Best Practices
Build recovery securely:
- Use random, hashed tokens with expiry
- Send via a transactional email provider
- Mark tokens used after one use
- Rate limit and avoid email enumeration
Quick Check
Test your reset-flow knowledge.
Recap
You built account recovery:
- Generate random tokens, store them hashed with expiry
- Email links via a transactional provider
- Verify, then update the password and mark the token used
- Reuse the pattern for email verification and guard against abuse
Users can now safely recover and verify accounts.
Yapay zeka eğitmeniyle AI Powered SaaS: Stripe + Auth + Billing + Deploy öğren — ücretsiz
Tarayıcında gerçek kod yaz ve çalıştır, 7/24 yapay zeka eğitmeninden anında yardım al; web'de ya da uygulamada kaldığın yerden devam et.
- Kurslar
- 12
- Dersler
- 48
Sıkça Sorulan Sorular
“Parola Sıfırlama ve E-posta Doğrulama” dersi ücretsiz mi?
Evet — “Parola Sıfırlama ve E-posta Doğrulama” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve AI Powered SaaS: Stripe + Auth + Billing + Deploy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. AI Powered SaaS: Stripe + Auth + Billing + Deploy kursu toplamda 4 dersten oluşur.
“Parola Sıfırlama ve E-posta Doğrulama” dersinde ne öğreneceğim?
Kullanıcıların erişimi güvenle geri kazanabilmesi için tek kullanımlık belirteçler, süre sonu ve işlemsel e-posta kullanarak güvenli hesap kurtarma ve e-posta doğrulama akışları oluşturun. AI Powered SaaS: Stripe + Auth + Billing + Deploy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
AI Powered SaaS: Stripe + Auth + Billing + Deploy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te AI Powered SaaS: Stripe + Auth + Billing + Deploy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Parola Sıfırlama ve E-posta Doğrulama” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu AI Powered SaaS: Stripe + Auth + Billing + Deploy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her AI Powered SaaS: Stripe + Auth + Billing + Deploy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Kullanıcı Kaydı ve Özetleme
- Giriş ve JWT Oluşturma
- Korumalı Rotalar ve Ara Katman Yazılımı
- Parola Sıfırlama ve E-posta Doğrulama