0Pricing
Firebase Auth & Realtime Database Apps · Lekcja

Resetowanie haseł i weryfikacja adresu e-mail

Uzupełnij uwierzytelnianie za pomocą adresu e-mail i hasła, umożliwiając użytkownikom resetowanie zapomnianych haseł oraz weryfikowanie adresów e-mail, co zwiększy bezpieczeństwo i ułatwi odzyskiwanie kont.

Resetowanie haseł i weryfikacja adresu e-mail to bezpłatna lekcja Firebase Auth & Realtime Database Apps na CoddyKit. To lekcja 4 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Firebase Auth & Realtime Database Apps, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Firebase Auth & Realtime Database Apps zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

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 sendPasswordResetEmail for forgotten passwords
  • Avoid revealing whether an email exists
  • Verify ownership with sendEmailVerification and emailVerified
  • Call reload to refresh status
  • Customize templates and enforce verification via rules

Często zadawane pytania

Czy lekcja „Resetowanie haseł i weryfikacja adresu e-mail” jest bezpłatna?

Tak — pełny tekst „Resetowanie haseł i weryfikacja adresu e-mail” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Firebase Auth & Realtime Database Apps, przejdź na CoddyKit PRO. Kurs Firebase Auth & Realtime Database Apps zawiera 4 lekcji w sumie.

Co nauczysz się w „Resetowanie haseł i weryfikacja adresu e-mail”?

Uzupełnij uwierzytelnianie za pomocą adresu e-mail i hasła, umożliwiając użytkownikom resetowanie zapomnianych haseł oraz weryfikowanie adresów e-mail, co zwiększy bezpieczeństwo i ułatwi odzyskiwani… Ćwiczysz Firebase Auth & Realtime Database Apps z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Firebase Auth & Realtime Database Apps?

Nie wymagamy żadnego doświadczenia. Firebase Auth & Realtime Database Apps w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 4 z 4.

Ile czasu zajmuje lekcja „Resetowanie haseł i weryfikacja adresu e-mail”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Firebase Auth & Realtime Database Apps?

Tak. Każda lekcja Firebase Auth & Realtime Database Apps zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Implementacja uwierzytelniania za pomocą e-maila i hasła
  2. Zarządzanie sesjami i stanami użytkowników
  3. Obsługa błędów uwierzytelniania
  4. Resetowanie haseł i weryfikacja adresu e-mail
← Powrót do Firebase Auth & Realtime Database Apps