Added some change to mutators

This commit is contained in:
Wyatt Johnson
2018-04-16 12:45:17 -06:00
parent 8dbfa8f274
commit ce291448f1
3 changed files with 10 additions and 6 deletions
+6 -5
View File
@@ -161,18 +161,18 @@ const changeUserPassword = async (ctx, oldPassword, newPassword) => {
await Users.changePassword(user.id, newPassword);
// Get some context for the email to be sent.
const { organizationName, organizationContactEmail } = await Settings.load(
const { organizationName, organizationContactEmail } = await Settings.load([
'organizationName',
'organizationContactEmail'
);
'organizationContactEmail',
]);
// Send the password change email.
await Users.sendEmail(user, {
template: 'plain',
locals: {
body: I18n.t('email.password_change.body', organizationName),
body: I18n.t('email.password_change.body', organizationContactEmail),
},
subject: I18n.t('email.password_change.subject', organizationContactEmail),
subject: I18n.t('email.password_change.subject', organizationName),
});
};
@@ -188,6 +188,7 @@ module.exports = ctx => {
setUsername: () => Promise.reject(new ErrNotAuthorized()),
stopIgnoringUser: () => Promise.reject(new ErrNotAuthorized()),
del: () => Promise.reject(new ErrNotAuthorized()),
changePassword: () => Promise.reject(new ErrNotAuthorized()),
},
};
+3
View File
@@ -139,6 +139,9 @@ const RootMutation = {
delUser: async (_, { id }, { mutators: { User } }) => {
await User.del(id);
},
changePassword: async (_, { input }, { mutators: { User } }) => {
await User.changePassword(input);
},
};
module.exports = RootMutation;
+1 -1
View File
@@ -220,7 +220,7 @@ en:
please_click: "please click here to reset password"
password_change:
subject: "{0} password change"
body: "Password was changed on your account.\n\nIf you did not request this change, please contact us at {0}."
body: "The password on your account has been changed.\n\nIf you did not request this change, please contact us at {0}."
embedlink:
copy: "Copy to Clipboard"
error: