2016-07-01 20 views
2

Firebase Web SDK3の電子メールアドレスを確認するオプションがあるようですが、here(自分のプロジェクトIDをリンクに入れてください)を参照してください。ただし、使用方法に関するドキュメントは見つかりません。Firebaseの電子メールアドレスの確認方法

誰でも完了しましたか?

答えて

0

は、AngularJSでは、あなたがこのに近づくだろうか基本的には次のとおりです。

// thecontroller.js 
$scope.sendVerifyEmail = function() { 
    console.log('Email sent, whaaaaam!'); 
    currentAuth.sendEmailVerification(); 
    } 

// where currentAuth came from something like this: 
// routerconfig 

.... 
templateUrl: 'bla.html', 
resolve: { 
    currentAuth:['Auth', function(Auth) { 
     return Auth.$requireSignIn() // this throws an AUTH_REQUIRED broadcast 
    }] 
    } 
... 

// intercept the broadcast like so if you want: 

.... 

$rootScope.$on("$stateChangeError", function(event, toState, toParams, fromState, fromParams, error) { 
     if (error === "AUTH_REQUIRED") { 
     $state.go('login', { toWhere: toState }); 
     } 
    }); 
.... 

// So user receives the email. How do you process the `oobCode` that returns? 
// You may do something like this: 

// catch the url with its mode and oobCode 
.state('emailVerify', { 
    url: '/verify-email?mode&oobCode', 
    templateUrl: 'auth/verify-email.html', 
    controller: 'emailVerifyController', 
    resolve: { 
    currentAuth:['Auth', function(Auth) { 
     return Auth.$requireSignIn() 
    }] 
    } 
}) 

// Then digest like so where each term is what they sound like: 

.controller('emailVerifyController', ['$scope', '$stateParams', 'currentAuth', 'DatabaseRef', 
    function($scope, $stateParams, currentAuth, DatabaseRef) { 
    console.log(currentAuth); 
    $scope.doVerify = function() { 
     firebase.auth() 
     .applyActionCode($stateParams.oobCode) 
     .then(function(data) { 
      // change emailVerified for logged in User 
      console.log('Verification happened'); 
     }) 
     .catch(function(error) { 
      $scope.error = error.message; 
      console.log(error.message, error.reason) 
     }) 
    }; 
    } 
]) 

は、私は答えを受け入れてきたように、確かにある種の文書であると思われる記事Email Verification with Firebase 3.0 SDK

2

かなりうまく隠されたが、ここに行く:https://firebase.google.com/docs/reference/js/firebase.User#sendEmailVerification

は、次に、あなたは自分の認証フローの一部としてemailVerifiedをチェックする必要があります。以下要するに

+0

でより多くのの説明しました。確かによく隠され、「疎」はそれを記述する別の種類の方法でしょう! – kpg

関連する問題