-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for resending verification email in case of expired token (…
…#3617) * -Defines new public API route /apps/:appId/resend_verification_email that will generate a new email verification link and email for a user identified by username in POST body -Add template and url support for invalidVerificationLink, linkSendSuccess, and linkSendFail pages. The invalidVerificationLink pages includes a button that allows the user to generate a new verification email if their current token has expired, using the new public API route -All three pages have default html that will be functional out of the box, but they can be customized in the customPages object. The custom page for invalidVerificationLink needs to handle the extraction of the username and appId from the url and the POST to generate the new link (this requires javascript) -Clicking a link for an email that has already been verified now routes to the emailVerifySuccess page instead of the invalidLink page * Fix package.json repo url to be parse-server againwq * Fix js lint issues * Update unit tests * Use arrow functions, change html page comments, use qs and a string template to construct location for invalidVerificationLink page, syntax fixes * Remember to pass result when using arrow function
- Loading branch information
1 parent
7b9ebc4
commit 22ba398
Showing
9 changed files
with
273 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ | |
padding: 0 0 0 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h1>Invalid Link</h1> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!DOCTYPE html> | ||
<!-- This page is displayed when someone navigates to a verify email or reset password link | ||
but their security token is wrong. This can either mean the user has clicked on a | ||
stale link (i.e. re-click on a password reset link after resetting their password) or | ||
(rarely) this could be a sign of a malicious user trying to tamper with your app. | ||
--> | ||
<html> | ||
<head> | ||
<title>Invalid Link</title> | ||
<style type='text/css'> | ||
.container { | ||
border-width: 0px; | ||
display: block; | ||
font: inherit; | ||
font-family: 'Helvetica Neue', Helvetica; | ||
font-size: 16px; | ||
height: 30px; | ||
line-height: 16px; | ||
margin: 45px 0px 0px 45px; | ||
padding: 0px 8px 0px 8px; | ||
position: relative; | ||
vertical-align: baseline; | ||
} | ||
|
||
h1, h2, h3, h4, h5 { | ||
color: #0067AB; | ||
display: block; | ||
font: inherit; | ||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica; | ||
font-size: 30px; | ||
font-weight: 600; | ||
height: 30px; | ||
line-height: 30px; | ||
margin: 0 0 15px 0; | ||
padding: 0 0 0 0; | ||
} | ||
</style> | ||
</head> | ||
<script type="text/javascript"> | ||
function getUrlParameter(name) { | ||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); | ||
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); | ||
var results = regex.exec(location.search); | ||
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); | ||
}; | ||
|
||
window.onload = addDataToForm; | ||
|
||
function addDataToForm() { | ||
var username = getUrlParameter("username"); | ||
document.getElementById("usernameField").value = username; | ||
|
||
var appId = getUrlParameter("appId"); | ||
document.getElementById("resendForm").action = '/apps/' + appId + '/resend_verification_email' | ||
} | ||
|
||
</script> | ||
|
||
<body> | ||
<div class="container"> | ||
<h1>Invalid Verification Link</h1> | ||
<form id="resendForm" method="POST" action="/resend_verification_email"> | ||
<input id="usernameField" class="form-control" name="username" type="hidden" value=""> | ||
<button type="submit" class="btn btn-default">Resend Link</button> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<!-- This page is displayed when someone navigates to a verify email link with an invalid | ||
security token and requests a link resend. This page is displayed when the username from | ||
the original link is invalid or if the email of that user has already been verfieid when | ||
the resend request is made | ||
--> | ||
<html> | ||
<head> | ||
<title>Invalid Link</title> | ||
<style type='text/css'> | ||
.container { | ||
border-width: 0px; | ||
display: block; | ||
font: inherit; | ||
font-family: 'Helvetica Neue', Helvetica; | ||
font-size: 16px; | ||
height: 30px; | ||
line-height: 16px; | ||
margin: 45px 0px 0px 45px; | ||
padding: 0px 8px 0px 8px; | ||
position: relative; | ||
vertical-align: baseline; | ||
} | ||
|
||
h1, h2, h3, h4, h5 { | ||
color: #0067AB; | ||
display: block; | ||
font: inherit; | ||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica; | ||
font-size: 30px; | ||
font-weight: 600; | ||
height: 30px; | ||
line-height: 30px; | ||
margin: 0 0 15px 0; | ||
padding: 0 0 0 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h1>No link sent. User not found or email already verified</h1> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<!-- This page is displayed when someone navigates to a verify email link with an invalid | ||
security token and requests a link resend. This page is displayed when the username | ||
from the original verification link has been found and a new verification link has | ||
been successfully sent to the corresponding stored email | ||
--> | ||
<html> | ||
<head> | ||
<title>Invalid Link</title> | ||
<style type='text/css'> | ||
.container { | ||
border-width: 0px; | ||
display: block; | ||
font: inherit; | ||
font-family: 'Helvetica Neue', Helvetica; | ||
font-size: 16px; | ||
height: 30px; | ||
line-height: 16px; | ||
margin: 45px 0px 0px 45px; | ||
padding: 0px 8px 0px 8px; | ||
position: relative; | ||
vertical-align: baseline; | ||
} | ||
|
||
h1, h2, h3, h4, h5 { | ||
color: #0067AB; | ||
display: block; | ||
font: inherit; | ||
font-family: 'Open Sans', 'Helvetica Neue', Helvetica; | ||
font-size: 30px; | ||
font-weight: 600; | ||
height: 30px; | ||
line-height: 30px; | ||
margin: 0 0 15px 0; | ||
padding: 0 0 0 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h1>Link Sent! Check your email.</h1> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.