0Pricing
Firebase Auth & Realtime Database Apps · レッスン

パスワードリセットとメールアドレス確認

ユーザーが忘れたパスワードをリセットし、メールアドレスを確認できるようにして、メールアドレス/パスワード認証を完成させ、セキュリティとアカウント復旧性を高めます。

「パスワードリセットとメールアドレス確認」はCoddyKit上の無料Firebase Auth & Realtime Database Appsレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはFirebase Auth & Realtime Database Apps学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Firebase Auth & Realtime Database Appsコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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

よくある質問

「パスワードリセットとメールアドレス確認」レッスンは無料ですか?

はい。「パスワードリセットとメールアドレス確認」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Firebase Auth & Realtime Database Appsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Firebase Auth & Realtime Database Appsコースには全4レッスンが含まれています。

「パスワードリセットとメールアドレス確認」で何を学びますか?

ユーザーが忘れたパスワードをリセットし、メールアドレスを確認できるようにして、メールアドレス/パスワード認証を完成させ、セキュリティとアカウント復旧性を高めます。 ブラウザで直接実行するハンズオンコードでFirebase Auth & Realtime Database Appsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Firebase Auth & Realtime Database Appsを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのFirebase Auth & Realtime Database Appsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「パスワードリセットとメールアドレス確認」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このFirebase Auth & Realtime Database Appsレッスンでコードを書いて実行できますか?

はい。すべてのFirebase Auth & Realtime Database Appsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. メール/パスワード認証の実装
  2. ユーザーセッションと状態の管理
  3. 認証エラーへの対応
  4. パスワードリセットとメールアドレス確認
← Firebase Auth & Realtime Database Appsに戻る