0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-15 03:01:37 -05:00

Added publication icon to 2fa email if available

This commit is contained in:
Sam Lord 2024-10-10 17:08:13 +01:00 committed by Kevin Ansfield
parent d2ca6e4a74
commit c9c8709fd3
3 changed files with 9 additions and 2 deletions

View file

@ -11,6 +11,7 @@ const expressSession = require('./express-session');
const models = require('../../../models');
const urlUtils = require('../../../../shared/url-utils');
const {blogIcon} = require('../../../lib/image');
const url = require('url');
// TODO: We have too many lines here, should move functions out into a utils module
@ -46,6 +47,10 @@ const sessionService = createSessionService({
getSettingsCache(key) {
return settingsCache.get(key);
},
getBlogLogo() {
return blogIcon.getIconUrl({absolute: true, fallbackToDefault: false})
|| 'https://static.ghost.org/v4.0.0/images/ghost-orb-1.png';
},
mailer,
urlUtils,
labs,

View file

@ -115,7 +115,7 @@ module.exports = ({t, siteTitle, email, siteDomain, siteUrl, siteLogo, token, de
<td class="wrapper" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top; box-sizing: border-box;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
<tr>
<td align="center" style="padding-top: 20px; padding-bottom: 12px;"><img src="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png" width="60" height="60" style="width: 60px; height: 60px;" /></td>
<td align="center" style="padding-top: 20px; padding-bottom: 12px;"><img src="${siteLogo}" width="60" height="60" style="width: 60px; height: 60px;" /></td>
</tr>
<tr>
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; vertical-align: top;">

View file

@ -52,6 +52,7 @@ totp.options = {
* @param {(data: {id: string}) => Promise<User>} deps.findUserById
* @param {(req: Req) => string} deps.getOriginOfRequest
* @param {(key: string) => string} deps.getSettingsCache
* @param {() => string} deps.getBlogLogo
* @param {import('../../core/core/server/services/mail').GhostMailer} deps.mailer
* @param {import('../../core/core/shared/labs')} deps.labs
* @param {import('../../core/core/server/services/i18n').t} deps.t
@ -64,6 +65,7 @@ module.exports = function createSessionService({
findUserById,
getOriginOfRequest,
getSettingsCache,
getBlogLogo,
mailer,
urlUtils,
labs,
@ -234,7 +236,7 @@ module.exports = function createSessionService({
}
const recipient = user.get('email');
const siteTitle = getSettingsCache('title');
const siteLogo = urlUtils.urlFor('image', {image: getSettingsCache('logo')}, true);
const siteLogo = getBlogLogo();
const siteUrl = urlUtils.urlFor('home', true);
const domain = urlUtils.urlFor('home', true).match(new RegExp('^https?://([^/:?#]+)(?:[/:?#]|$)', 'i'));
const siteDomain = (domain && domain[1]);