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
This commit is contained in:
parent
04291e1ba4
commit
d9eaee3939
42 changed files with 715 additions and 24 deletions
|
@ -60,7 +60,8 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
|
|||
serverVersion: packageJSON.version,
|
||||
signup: {
|
||||
allowed,
|
||||
allowedForCurrentIP
|
||||
allowedForCurrentIP,
|
||||
requiresEmailVerification: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION
|
||||
},
|
||||
transcoding: {
|
||||
enabledResolutions
|
||||
|
@ -159,12 +160,20 @@ async function updateCustomConfig (req: express.Request, res: express.Response,
|
|||
toUpdate.transcoding.threads = parseInt('' + toUpdate.transcoding.threads, 10)
|
||||
|
||||
// camelCase to snake_case key
|
||||
const toUpdateJSON = omit(toUpdate, 'user.videoQuota', 'instance.defaultClientRoute', 'instance.shortDescription', 'cache.videoCaptions')
|
||||
const toUpdateJSON = omit(
|
||||
toUpdate,
|
||||
'user.videoQuota',
|
||||
'instance.defaultClientRoute',
|
||||
'instance.shortDescription',
|
||||
'cache.videoCaptions',
|
||||
'signup.requiresEmailVerification'
|
||||
)
|
||||
toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota
|
||||
toUpdateJSON.user['video_quota_daily'] = toUpdate.user.videoQuotaDaily
|
||||
toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute
|
||||
toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription
|
||||
toUpdateJSON.instance['default_nsfw_policy'] = toUpdate.instance.defaultNSFWPolicy
|
||||
toUpdateJSON.signup['requires_email_verification'] = toUpdate.signup.requiresEmailVerification
|
||||
|
||||
await writeJSON(CONFIG.CUSTOM_FILE, toUpdateJSON, { spaces: 2 })
|
||||
|
||||
|
@ -220,7 +229,8 @@ function customConfig (): CustomConfig {
|
|||
},
|
||||
signup: {
|
||||
enabled: CONFIG.SIGNUP.ENABLED,
|
||||
limit: CONFIG.SIGNUP.LIMIT
|
||||
limit: CONFIG.SIGNUP.LIMIT,
|
||||
requiresEmailVerification: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION
|
||||
},
|
||||
admin: {
|
||||
email: CONFIG.ADMIN.EMAIL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue