diff options
author | Josh Morel <morel.josh@hotmail.com> | 2018-08-31 03:18:19 -0400 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-31 09:18:19 +0200 |
commit | d9eaee3939bf2e93e5d775d32bce77842201faba (patch) | |
tree | c115acb3611986b98f51b3addf29ebe66f63ee7f /server/tests/utils/users | |
parent | 04291e1ba44032165388758e993d385a10c1c5a1 (diff) | |
download | PeerTube-d9eaee3939bf2e93e5d775d32bce77842201faba.tar.gz PeerTube-d9eaee3939bf2e93e5d775d32bce77842201faba.tar.zst PeerTube-d9eaee3939bf2e93e5d775d32bce77842201faba.zip |
add user account email verificiation (#977)
* add user account email verificiation
includes server and client code to:
* enable verificationRequired via custom config
* send verification email with registration
* ask for verification email
* verify via email
* prevent login if not verified and required
* conditional client links to ask for new verification email
* allow login for verified=null
these are users created when verification not required
should still be able to login when verification is enabled
* refactor email verifcation pr
* change naming from verified to emailVerified
* change naming from askVerifyEmail to askSendVerifyEmail
* undo unrelated automatic prettier formatting on api/config
* use redirectService for home
* remove redundant success notification on email verified
* revert test.yaml smpt host
Diffstat (limited to 'server/tests/utils/users')
-rw-r--r-- | server/tests/utils/users/users.ts | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts index 5dba34b69..cd1b07701 100644 --- a/server/tests/utils/users/users.ts +++ b/server/tests/utils/users/users.ts | |||
@@ -246,6 +246,28 @@ function resetPassword (url: string, userId: number, verificationString: string, | |||
246 | }) | 246 | }) |
247 | } | 247 | } |
248 | 248 | ||
249 | function askSendVerifyEmail (url: string, email: string) { | ||
250 | const path = '/api/v1/users/ask-send-verify-email' | ||
251 | |||
252 | return makePostBodyRequest({ | ||
253 | url, | ||
254 | path, | ||
255 | fields: { email }, | ||
256 | statusCodeExpected: 204 | ||
257 | }) | ||
258 | } | ||
259 | |||
260 | function verifyEmail (url: string, userId: number, verificationString: string, statusCodeExpected = 204) { | ||
261 | const path = '/api/v1/users/' + userId + '/verify-email' | ||
262 | |||
263 | return makePostBodyRequest({ | ||
264 | url, | ||
265 | path, | ||
266 | fields: { verificationString }, | ||
267 | statusCodeExpected | ||
268 | }) | ||
269 | } | ||
270 | |||
249 | // --------------------------------------------------------------------------- | 271 | // --------------------------------------------------------------------------- |
250 | 272 | ||
251 | export { | 273 | export { |
@@ -265,5 +287,7 @@ export { | |||
265 | unblockUser, | 287 | unblockUser, |
266 | askResetPassword, | 288 | askResetPassword, |
267 | resetPassword, | 289 | resetPassword, |
268 | updateMyAvatar | 290 | updateMyAvatar, |
291 | askSendVerifyEmail, | ||
292 | verifyEmail | ||
269 | } | 293 | } |