use rawEmail when sending mail

This commit is contained in:
Danny Coates 2014-01-06 13:31:40 -08:00
Родитель 43d36c1aed
Коммит f607491bf1
5 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -134,6 +134,7 @@ module.exports = function (
email: data && data.email
}
)
data.rawEmail = data.email
var sql = 'INSERT INTO accounts (uid, email, rawEmail, emailCode, verified, kA, wrapWrapKb, authSalt, verifyHash) VALUES (?, LOWER(?), ?, ?, ?, ?, ?, ?, ?)'
return this.getMasterConnection()
.then(function(con) {
@ -143,7 +144,7 @@ module.exports = function (
[
data.uid,
data.email,
data.email,
data.rawEmail,
data.emailCode,
data.verified,
data.kA,
@ -336,7 +337,7 @@ module.exports = function (
MySql.prototype.sessionToken = function (id) {
log.trace({ op: 'MySql.sessionToken', id: id })
var sql = 'SELECT t.tokendata, t.uid, a.verified, a.email, a.emailCode' +
var sql = 'SELECT t.tokendata, t.uid, a.verified, a.email, a.rawEmail, a.emailCode' +
' FROM sessionTokens t, accounts a WHERE t.tokenid = ? AND t.uid = a.uid'
return this.getSlaveConnection()
.then(function(con) {
@ -416,7 +417,7 @@ module.exports = function (
MySql.prototype.passwordForgotToken = function (id) {
log.trace({ op: 'MySql.passwordForgotToken', id: id })
var sql = 'SELECT t.tokendata, t.uid, a.email, t.passcode, t.created, t.tries ' +
var sql = 'SELECT t.tokendata, t.uid, a.email, a.rawEmail, t.passcode, t.created, t.tries ' +
' FROM passwordForgotTokens t, accounts a WHERE t.tokenid = ? AND t.uid = a.uid'
return this.getSlaveConnection()
.then(function(con) {

Просмотреть файл

@ -82,7 +82,7 @@ module.exports = function (config, i18n, log) {
}
Mailer.prototype.sendVerifyCode = function (account, code, service, preferredLang) {
log.trace({ op: 'mailer.sendVerifyCode', email: account.email, uid: account.uid })
log.trace({ op: 'mailer.sendVerifyCode', email: account.rawEmail, uid: account.uid })
var template = templates.verify
var link = this.verificationUrl + '?uid=' + account.uid.toString('hex')
if (service) {
@ -98,7 +98,7 @@ module.exports = function (config, i18n, log) {
}
var message = {
sender: this.sender,
to: account.email,
to: account.rawEmail,
subject: values.l10n.gettext(template.subject),
text: template.text(values),
html: template.html(values),
@ -113,7 +113,7 @@ module.exports = function (config, i18n, log) {
}
Mailer.prototype.sendRecoveryCode = function (account, code, preferredLang) {
log.trace({ op: 'mailer.sendRecoveryCode', email: account.email })
log.trace({ op: 'mailer.sendRecoveryCode', email: account.rawEmail })
var template = templates.reset
var values = {
l10n: i18n.localizationContext(preferredLang),
@ -121,7 +121,7 @@ module.exports = function (config, i18n, log) {
}
var message = {
sender: this.sender,
to: account.email,
to: account.rawEmail,
subject: values.l10n.gettext(template.subject),
text: template.text(values),
html: template.html(values),

Просмотреть файл

@ -164,6 +164,7 @@ module.exports = function (log, crypto, P, uuid, isA, error, db, mailer, isProdu
{
uid: emailRecord.uid,
email: emailRecord.email,
rawEmail: emailRecord.rawEmail,
emailCode: emailRecord.emailCode,
verified: emailRecord.verified
}

Просмотреть файл

@ -9,6 +9,7 @@ module.exports = function (log, inherits, now, Token, crypto) {
function PasswordForgotToken(keys, details) {
Token.call(this, keys, details)
this.email = details.email || null
this.rawEmail = details.rawEmail || null
this.created = details.created || null
this.passcode = details.passcode || null
this.tries = details.tries || null

Просмотреть файл

@ -7,6 +7,7 @@ module.exports = function (log, inherits, Token) {
function SessionToken(keys, details) {
Token.call(this, keys, details)
this.email = details.email || null
this.rawEmail = details.rawEmail || null
this.emailCode = details.emailCode || null
this.verified = !!details.verified
}