-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(auth): Implement Passwordless Authentication #9660
feat(auth): Implement Passwordless Authentication #9660
Conversation
@atjonathan @raisedadead @BerkeleyTrue I have created a new issue related to this here: #10407 |
@raisedadead Please continue to work on this. #10407 does not change the user stories of this PR. |
Reopening this because the underlying passwordless functionality is still needed for updating the workflow. |
@raisedadead I know you're recovering from the flu. I just wanted to check and see how this is coming along, and let you know that going passwordless is still a priority for us 😄 |
Hi @QuincyLarson, just got back. I plan to work on this from tomorrow. Sorry about the delay. |
@raisedadead no need to apologize - thanks for helping us implement this! |
Just a rebase of the mess that I created. Will be ready with the feature in the next push. |
👍 |
Basic functionality is there out now… just some more validation touches and code optimisations and we are good (soon). |
@raisedadead awesome - thank you for keeping us posted 😄 |
Would appreciate a review and guidance from anyone. |
Never mind my last comment. I figured out that I was just more sleepy than I should have been last night. This is ready for QA. |
common/models/user.js
Outdated
if (!isEmail(email)) { | ||
return Promise.reject( | ||
new Error('The submitted email not valid.') | ||
); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
email: email, | ||
emailVerified: false | ||
}; | ||
return User.findOrCreate$({ where: { email: userObj.email }}, userObj) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
.map(([ err, user, isCreated ]) => { | ||
if (err) { | ||
return dedent` | ||
Oops, something is not right, please try again later.`; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
'a few seconds'; | ||
debug('request before wait time : ' + timeToWait); | ||
return dedent` | ||
Please wait ${timeToWait} to resend an authentication link.`; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
let emailTemplate = 'user-request-sign-in.ejs'; | ||
if (isCreated) { | ||
emailTemplate = 'user-request-sign-up.ejs'; | ||
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
|
||
return dedent` | ||
If you entered a valid email, a magic link is on its way. | ||
Please follow that link to sign in.`; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
.map((msg) => { | ||
if (msg) { return msg; } | ||
return dedent` | ||
Oops, something is not right, please try again later.`; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
return dedent` | ||
Oops, something is not right, please try again later.`; | ||
}) | ||
.catch(error => { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
return Observable.throw(new Error( | ||
`Please wait ${timeToWait} to resend email verification.` | ||
)); | ||
if (!isDev) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -152,6 +153,9 @@ module.exports = function(app) { | |||
); | |||
} | |||
|
|||
AccessToken.findOne$ = Observable.fromNodeCallback( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
common/models/user.js
Outdated
emailVerified: false | ||
}; | ||
return User.findOrCreate$({ where: { email }}, userObj) | ||
.map(([ err, user, isCreated ]) => { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Allows setting the SES_ID, SES_SECRET and EMAIL_SENDER values
@raisedadead updated the pull request. |
woot!! |
@BerkeleyTrue this is ready for QA. Please check when you can. Thanks. |
Looks good. I'll merge when I get to a computer |
merged!!!!!!!!!!!!!!!!!!!! ✨ 🎊 🚀 I owe you a 🍺 Happy Coding! |
@BerkeleyTrue awesome, thanks a lot for the QA. Do let me know how it goes when deployed? |
Feature Checklist:
Create API for creating/saving an access tokenUsing loopbacks defaultsCloses #8165
Closes #9027
Closes #15254