-
Notifications
You must be signed in to change notification settings - Fork 625
Add requireEmailVerification argument to $requireSignIn() firebase auth router helper #887
Conversation
|
I wonder if this would be more appropriate as an argument to $requireSignIn? Is there a case where you would require email verification but not sign in? I don't think there is. |
|
Good point! You're right it wouldn't make sense to need email verification but not sign in. |
|
Looks good! Could we also get this into the test units? |
|
Sure! :) Btw, are you familiar with this error? |
jwngr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking solid to me. I agree we need to add some tests for it though.
Regarding the tests not working for you locally: what version of Node.js are you using to run the tests? I know Chrome recently added in error messages about uncaught promises, so that is probably what is yelling. It may be safe to ignore or maybe we need to do some more digging. I can't reproduce what you're seeing though, so knowing what version of Node.js you're on will be helpful.
src/auth/FirebaseAuth.js
Outdated
| res = self._q.reject("AUTH_REQUIRED"); | ||
| } | ||
| else if (rejectIfEmailNotVerified && !authData.emailVerified) { | ||
| res = self._q.reject("EMAIL_NOT_VERIFIED"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: "EMAIL_VERIFICATION_REQUIRED"
|
Thanks for the help! I added some unit tests and updated the error code as you suggested. All the Auth tests passed, but I still couldn't get the others working, so I ignored them. FYI: |
|
Looks great! Thanks for your contribution! I'm going to hold off on merging this in just yet since it updates documentation and I want to time it with the next release. I'll cut a new release before I head off for the holidays at the end of this week. I'll also look into the testing issues. I was able to reproduce them with Node.js 4.4.5 / Chrome 55.0.2883. Thanks for the added setup info you shared. |
|
FYI I just fixed the unit test issue with #890. |
|
Great! Thank you both for all the help and for looking at this so quickly! :) |
|
This has been released as part of AngularFire |
Description
This adds an argument (requireEmailVerification) to the $requireSignIn router helper in the angularfire auth service.
When set to true, this will fail if the firebase auth "emailVerified" property is false.
This is useful if you do not want users to access your app until they have verified their email address.
Code sample