Redefinição de Senha e Verificação de E-mail
Complete a autenticação por e-mail e senha permitindo que os usuários redefinam senhas esquecidas e verifiquem seus endereços de e-mail, melhorando a segurança e a recuperação das contas.
Redefinição de Senha e Verificação de E-mail é uma aula grátis de Firebase Auth & Realtime Database Apps no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Firebase Auth & Realtime Database Apps, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Firebase Auth & Realtime Database Apps inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
Why Reset and Verification Matter
Email/password sign-in is incomplete without two flows: password reset for forgotten credentials and email verification to prove the user owns the address.
- Reset reduces support tickets and lockouts
- Verification blocks fake or mistyped emails
How Password Reset Works
The flow is entirely email-driven so the user never reveals an old password:
- User requests a reset for their email
- Firebase sends a secure, time-limited link
- User clicks it and chooses a new password
Your app only triggers the email; Firebase hosts the reset page by default.
Triggering a Reset Email
Call sendPasswordResetEmail with the user's address. Firebase handles delivery and the link.
import { getAuth, sendPasswordResetEmail } from 'firebase/auth';
const auth = getAuth();
await sendPasswordResetEmail(auth, 'user@example.com');
console.log('Reset email sent');Handling Reset Errors Gracefully
For security, avoid revealing whether an email exists. Show the same confirmation message whether or not the account is found.
try {
await sendPasswordResetEmail(auth, email);
} catch (e) {
// log internally but do not expose to user
}
showMessage('If that email exists, a reset link was sent.');Sending a Verification Email
After a user signs up, send a verification email with sendEmailVerification on the current user object.
import { getAuth, sendEmailVerification } from 'firebase/auth';
const user = getAuth().currentUser;
if (user) {
await sendEmailVerification(user);
}Checking Verification Status
The user object exposes emailVerified. Use it to gate sensitive features until the address is confirmed.
const user = getAuth().currentUser;
if (user && !user.emailVerified) {
showBanner('Please verify your email to continue.');
}Refreshing the Token After Verification
The emailVerified flag is cached in the ID token. After a user verifies, call reload to refresh their local state.
const user = getAuth().currentUser;
await user.reload();
console.log('Verified now?', user.emailVerified);Customizing Email Templates
In the Firebase console under Authentication > Templates you can customize the sender name, subject, and body of reset and verification emails, and set a custom action URL for branded pages.
Enforcing Verification
You can require a verified email before granting access to certain data using Security Rules. Tokens carry an email_verified claim you can check.
{
"rules": {
"posts": {
".write": "auth != null && auth.token.email_verified == true"
}
}
}Rate Limiting and Abuse
Firebase throttles repeated reset and verification requests to prevent abuse and spam. In your UI, disable the button briefly after sending so users do not trigger the limit accidentally.
Putting It Together
A complete signup typically looks like: create account, send verification email, show a 'check your inbox' screen, and reveal full features once emailVerified becomes true. A 'Forgot password?' link calls the reset flow.
Quick Check
Test your understanding of reset and verification.
Recap
Your email/password auth is now complete and recoverable.
- Use
sendPasswordResetEmailfor forgotten passwords - Avoid revealing whether an email exists
- Verify ownership with
sendEmailVerificationandemailVerified - Call
reloadto refresh status - Customize templates and enforce verification via rules
Perguntas Frequentes
A aula “Redefinição de Senha e Verificação de E-mail” é grátis?
Sim — o texto completo de “Redefinição de Senha e Verificação de E-mail” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Firebase Auth & Realtime Database Apps, atualize para CoddyKit PRO. O curso de Firebase Auth & Realtime Database Apps inclui 4 aulas no total.
O que vou aprender em “Redefinição de Senha e Verificação de E-mail”?
Complete a autenticação por e-mail e senha permitindo que os usuários redefinam senhas esquecidas e verifiquem seus endereços de e-mail, melhorando a segurança e a recuperação das contas. Você pratica Firebase Auth & Realtime Database Apps com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar Firebase Auth & Realtime Database Apps?
Nenhuma experiência prévia é necessária. Firebase Auth & Realtime Database Apps no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.
Quanto tempo leva a aula “Redefinição de Senha e Verificação de E-mail”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de Firebase Auth & Realtime Database Apps?
Sim. Cada aula de Firebase Auth & Realtime Database Apps inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- Implementação da autenticação por e-mail e senha
- Gerenciamento de sessões e estados dos usuários
- Tratamento de erros de autenticação
- Redefinição de Senha e Verificação de E-mail