Merge branch 'release' into develop

This commit is contained in:
Sabe Jones
2019-07-22 16:38:07 -05:00
9 changed files with 31 additions and 101 deletions
-3
View File
@@ -278,9 +278,6 @@
"passwordConfirmationMatch": "Password confirmation doesn't match password.",
"passwordResetPage": "Reset Password",
"passwordReset": "If we have your email on file, instructions for setting a new password have been sent to your email.",
"passwordResetEmailSubject": "Password Reset for Habitica",
"passwordResetEmailText": "If you requested a password reset for <%= username %> on Habitica, head to <%= passwordResetLink %> to set a new one. The link will expire after 24 hours. If you haven't requested a password reset, please ignore this email.",
"passwordResetEmailHtml": "If you requested a password reset for <strong><%= username %></strong> on Habitica, <a href=\"<%= passwordResetLink %>\">click here</a> to set a new one. The link will expire after 24 hours.<br/><br>If you haven't requested a password reset, please ignore this email.",
"invalidLoginCredentialsLong": "Uh-oh - your email address / username or password is incorrect.\n- Make sure they are typed correctly. Your username and password are case-sensitive.\n- You may have signed up with Facebook or Google-sign-in, not email so double-check by trying them.\n- If you forgot your password, click \"Forgot Password\".",
"invalidCredentials": "There is no account that uses those credentials.",
"accountSuspended": "This account, User ID \"<%= userId %>\", has been blocked for breaking the Community Guidelines (https://habitica.com/static/community-guidelines) or Terms of Service (https://habitica.com/static/terms). For details or to ask to be unblocked, please email our Community Manager at <%= communityManagerEmail %> or ask your parent or guardian to email them. Please include your @Username in the email.",
+4 -14
View File
@@ -11,7 +11,7 @@ import {
BadRequest,
} from '../../libs/errors';
import * as passwordUtils from '../../libs/password';
import { send as sendEmail } from '../../libs/email';
import { sendTxn as sendTxnEmail } from '../../libs/email';
import { validatePasswordResetCodeAndFindUser, convertToBcrypt} from '../../libs/password';
import { encrypt } from '../../libs/encryption';
import {
@@ -303,19 +303,9 @@ api.resetPassword = {
user.auth.local.passwordResetCode = passwordResetCode;
sendEmail({
from: 'Habitica <admin@habitica.com>',
to: email,
subject: res.t('passwordResetEmailSubject'),
text: res.t('passwordResetEmailText', {
username: user.auth.local.username,
passwordResetLink: link,
}),
html: res.t('passwordResetEmailHtml', {
username: user.auth.local.username,
passwordResetLink: link,
}),
});
sendTxnEmail(user, 'reset-password', [
{name: 'PASSWORD_RESET_LINK', content: link},
]);
await user.save();
}
+1 -16
View File
@@ -1,4 +1,3 @@
import nodemailer from 'nodemailer';
import nconf from 'nconf';
import { TAVERN_ID } from '../models/group';
import { encrypt } from './encryption';
@@ -16,25 +15,11 @@ const EMAIL_SERVER = {
};
const BASE_URL = nconf.get('BASE_URL');
let smtpTransporter = nodemailer.createTransport({
service: nconf.get('SMTP_SERVICE'),
auth: {
user: nconf.get('SMTP_USER'),
pass: nconf.get('SMTP_PASS'),
},
});
// Send email directly from the server using the smtpTransporter,
// used only to send password reset emails because users unsubscribed on Mandrill wouldn't get them
export function send (mailData) {
return smtpTransporter.sendMail(mailData); // promise
}
export function getUserInfo (user, fields = []) {
let info = {};
if (fields.indexOf('name') !== -1) {
info.name = user.profile && user.profile.name;
info.name = user.auth && user.auth.local.username;
}
if (fields.indexOf('email') !== -1) {