added post verify email
This commit is contained in:
Родитель
454f1a377d
Коммит
c3eb84d4ff
|
@ -159,6 +159,26 @@ var conf = convict({
|
|||
format: String,
|
||||
default: undefined
|
||||
},
|
||||
syncUrl: {
|
||||
doc: 'url to Sync product page',
|
||||
format: String,
|
||||
default: 'https://www.mozilla.org/en-US/firefox/sync/'
|
||||
},
|
||||
androidUrl: {
|
||||
doc: 'url to Android product page',
|
||||
format: String,
|
||||
default: 'https://www.mozilla.org/en-US/firefox/android/'
|
||||
},
|
||||
iosUrl: {
|
||||
doc: 'url to IOS product page',
|
||||
format: String,
|
||||
default: 'https://www.mozilla.org/en-US/firefox/ios/'
|
||||
},
|
||||
supportUrl: {
|
||||
doc: 'url to Mozilla Support product page',
|
||||
format: String,
|
||||
default: 'https://support.mozilla.org'
|
||||
},
|
||||
redirectDomain: {
|
||||
doc: 'Domain that mail urls are allowed to redirect to',
|
||||
format: String,
|
||||
|
@ -328,6 +348,7 @@ var conf = convict({
|
|||
|
||||
var files = (process.env.CONFIG_FILES || '').split(',').filter(fs.existsSync)
|
||||
conf.loadFile(files)
|
||||
conf.validate({ strict: true })
|
||||
|
||||
// set the public url as the issuer domain for assertions
|
||||
conf.set('domain', url.parse(conf.get('publicUrl')).host)
|
||||
|
@ -336,13 +357,9 @@ conf.set('domain', url.parse(conf.get('publicUrl')).host)
|
|||
conf.set('smtp.verificationUrl', conf.get('contentServer.url') + '/v1/verify_email')
|
||||
conf.set('smtp.passwordResetUrl', conf.get('contentServer.url') + '/v1/complete_reset_password')
|
||||
conf.set('smtp.accountUnlockUrl', conf.get('contentServer.url') + '/v1/complete_unlock_account')
|
||||
conf.set('smtp.initiatePasswordResetUrl', conf.get('contentServer.url') + '/v1/reset_password')
|
||||
conf.set('smtp.initiatePasswordResetUrl', conf.get('contentServer.url') + '/reset_password')
|
||||
conf.set('smtp.initiatePasswordChangeUrl', conf.get('contentServer.url') + '/settings/change_password')
|
||||
|
||||
var options = {
|
||||
strict: true
|
||||
}
|
||||
|
||||
conf.validate(options)
|
||||
|
||||
conf.set('isProduction', conf.get('env') === 'prod')
|
||||
|
||||
|
|
|
@ -81,6 +81,14 @@ module.exports = function (config, log) {
|
|||
}
|
||||
))
|
||||
}
|
||||
mailer.sendPostVerifyEmail = function (email, opts) {
|
||||
return P.resolve(mailer.postVerifyEmail(
|
||||
{
|
||||
email: email,
|
||||
acceptLanguage: opts.acceptLanguage || defaultLanguage
|
||||
}
|
||||
))
|
||||
}
|
||||
return mailer
|
||||
}
|
||||
)
|
||||
|
|
|
@ -656,6 +656,14 @@ module.exports = function (
|
|||
log.event('verified', { email: account.email, uid: account.uid, locale: account.locale })
|
||||
log.increment('account.verified')
|
||||
return db.verifyEmail(account)
|
||||
.then(mailer.sendPostVerifyEmail.bind(
|
||||
mailer,
|
||||
account.email,
|
||||
{
|
||||
acceptLanguage: request.app.acceptLanguage
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
.done(
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -98,6 +98,12 @@ Client.createAndVerify = function (origin, email, password, mailbox, options) {
|
|||
return client.verifyEmail(code)
|
||||
}
|
||||
)
|
||||
.then(
|
||||
function () {
|
||||
// clear the post verified email
|
||||
return mailbox.waitForEmail(email)
|
||||
}
|
||||
)
|
||||
.then(
|
||||
function () {
|
||||
return client
|
||||
|
|
|
@ -60,6 +60,20 @@ TestServer.start(config)
|
|||
return client.verifyEmail(verifyCode)
|
||||
}
|
||||
)
|
||||
|
||||
.then(
|
||||
function () {
|
||||
return server.mailbox.waitForEmail(email)
|
||||
}
|
||||
)
|
||||
.then(
|
||||
function (emailData) {
|
||||
t.equal(
|
||||
emailData.headers['x-link'],
|
||||
config.smtp.syncUrl,
|
||||
'sync url present')
|
||||
}
|
||||
)
|
||||
.then(
|
||||
function () {
|
||||
return client.emailStatus()
|
||||
|
|
|
@ -114,9 +114,13 @@ TestServer.start(config)
|
|||
)
|
||||
.then(
|
||||
function (emailData) {
|
||||
var link = emailData.headers['x-link']
|
||||
var query = url.parse(link, true).query
|
||||
t.ok(query.email, 'email is in the link')
|
||||
var changeUrl = url.parse(emailData.headers['x-link'], true)
|
||||
t.ok(
|
||||
changeUrl.href.indexOf(
|
||||
config.smtp.initiatePasswordChangeUrl) === 0,
|
||||
'links to change password'
|
||||
)
|
||||
t.equal(changeUrl.query.email, email, 'with email querystring')
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче