mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
Update email template config
This commit is contained in:
parent
24d5a5116f
commit
7ab44d4b0f
@ -72,6 +72,14 @@
|
|||||||
"policies": []
|
"policies": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/email-template",
|
||||||
|
"handler": "UsersPermissions.updateEmailTemplate",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,6 +6,9 @@
|
|||||||
* @description: A set of functions called "actions" of the `users-permissions` plugin.
|
* @description: A set of functions called "actions" of the `users-permissions` plugin.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -149,5 +152,19 @@ module.exports = {
|
|||||||
|
|
||||||
getEmailTemplate: async (ctx) => {
|
getEmailTemplate: async (ctx) => {
|
||||||
ctx.send(strapi.plugins['users-permissions'].config.email);
|
ctx.send(strapi.plugins['users-permissions'].config.email);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateEmailTemplate: async (ctx) => {
|
||||||
|
if (_.isEmpty(ctx.request.body)) {
|
||||||
|
return ctx.badRequest(null, [{ messages: [{ id: 'Cannot be empty' }] }]);
|
||||||
|
}
|
||||||
|
|
||||||
|
strapi.plugins['users-permissions'].config.email = ctx.request.body;
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join(strapi.config.appPath, 'plugins', 'users-permissions', 'config', 'email.json'), JSON.stringify({
|
||||||
|
email: strapi.plugins['users-permissions'].config.email
|
||||||
|
}, null, 2), 'utf8');
|
||||||
|
|
||||||
|
return ctx.send({ ok: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user