Closed mfarees closed 7 years ago
For the time being I have written the following code in the login function in auth.service.js,
var [err, foundUser] = await to( auth.__authenticate(user) )
if (foundUser.isVerified == false) {
err = {message: "Verify your Email Address"};
}
And changed this line
return auth.currentUser
to this, in the signup function
return false
Is this an acceptable approach?
You can always use the isVerified()
hook.
verifyHooks.isVerified()
Use it on the before
create
authentication
service in the authentication.js file.
Here's the library you import
const verifyHooks = require('feathers-authentication-management').hooks;
Some people may want users to be able to login without being verified or perhaps only be able to do limited tasks while unverified.
The only other change you'll need to make is taking out the portion of the auth.service.js
in the signup
method that automatically calls login after creating a user and change the notification.
Ok. I'll try that. Thanks
I found this project very helpful. Thanks for the effort. I'm currently still exploring the project and might have missed it, but shouldn't users be unable to login if their email is unverified? If there's no support for this, kindly share some hints on how I can implement this.
Thanks