mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-06 13:27:45 +00:00
fix: remove 3rd party assets from mail (#3569)
This commit is contained in:
parent
2e97394246
commit
ef6fd5a843
@ -132,7 +132,7 @@ func startZitadel(config *Config, masterKey string) error {
|
||||
return fmt.Errorf("cannot start commands: %w", err)
|
||||
}
|
||||
|
||||
notification.Start(config.Notification, config.ExternalPort, config.ExternalSecure, commands, queries, dbClient, assets.HandlerPrefix, keys.User, keys.SMTP, keys.SMS)
|
||||
notification.Start(config.Notification, config.ExternalPort, config.ExternalSecure, commands, queries, dbClient, assets.HandlerPrefix, config.SystemDefaults.Notifications.FileSystemPath, keys.User, keys.SMTP, keys.SMS)
|
||||
|
||||
router := mux.NewRouter()
|
||||
err = startAPIs(ctx, router, commands, queries, eventstoreClient, dbClient, config, storage, authZRepo, keys)
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,7 @@
|
||||
package hook
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"reflect"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
@ -20,6 +21,6 @@ func Base64ToBytesHookFunc() mapstructure.DecodeHookFuncType {
|
||||
return data, nil
|
||||
}
|
||||
|
||||
return []byte(data.(string)), nil
|
||||
return base64.StdEncoding.DecodeString(data.(string))
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ func Start(config Config,
|
||||
command *command.Commands,
|
||||
queries *query.Queries,
|
||||
dbClient *sql.DB,
|
||||
assetsPrefix string,
|
||||
assetsPrefix,
|
||||
fileSystemPath string,
|
||||
userEncryption crypto.EncryptionAlgorithm,
|
||||
smtpEncryption crypto.EncryptionAlgorithm,
|
||||
smsEncryption crypto.EncryptionAlgorithm,
|
||||
@ -32,6 +33,6 @@ func Start(config Config,
|
||||
statikFS, err := fs.NewWithNamespace("notification")
|
||||
logging.OnError(err).Panic("unable to start listener")
|
||||
|
||||
_, err = eventsourcing.Start(config.Repository, statikFS, externalPort, externalSecure, command, queries, dbClient, assetsPrefix, userEncryption, smtpEncryption, smsEncryption)
|
||||
_, err = eventsourcing.Start(config.Repository, statikFS, externalPort, externalSecure, command, queries, dbClient, assetsPrefix, fileSystemPath, userEncryption, smtpEncryption, smsEncryption)
|
||||
logging.OnError(err).Panic("unable to start app")
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ func Register(configs Configs,
|
||||
externalPort uint16,
|
||||
externalSecure bool,
|
||||
dir http.FileSystem,
|
||||
assetsPrefix string,
|
||||
assetsPrefix,
|
||||
fileSystemPath string,
|
||||
userEncryption crypto.EncryptionAlgorithm,
|
||||
smtpEncryption crypto.EncryptionAlgorithm,
|
||||
smsEncryption crypto.EncryptionAlgorithm,
|
||||
@ -59,6 +60,7 @@ func Register(configs Configs,
|
||||
externalSecure,
|
||||
dir,
|
||||
assetsPrefix,
|
||||
fileSystemPath,
|
||||
userEncryption,
|
||||
smtpEncryption,
|
||||
smsEncryption,
|
||||
|
@ -59,7 +59,8 @@ func newNotification(
|
||||
externalPort uint16,
|
||||
externalSecure bool,
|
||||
statikDir http.FileSystem,
|
||||
assetsPrefix string,
|
||||
assetsPrefix,
|
||||
fileSystemPath string,
|
||||
userEncryption crypto.EncryptionAlgorithm,
|
||||
smtpEncryption crypto.EncryptionAlgorithm,
|
||||
smsEncryption crypto.EncryptionAlgorithm,
|
||||
@ -75,6 +76,7 @@ func newNotification(
|
||||
smsTokenCrypto: smsEncryption,
|
||||
externalSecure: externalSecure,
|
||||
externalPort: externalPort,
|
||||
fileSystemPath: fileSystemPath,
|
||||
}
|
||||
|
||||
h.subscribe()
|
||||
|
@ -28,7 +28,8 @@ func Start(conf Config,
|
||||
command *command.Commands,
|
||||
queries *query.Queries,
|
||||
dbClient *sql.DB,
|
||||
assetsPrefix string,
|
||||
assetsPrefix,
|
||||
fileSystemPath string,
|
||||
userEncryption crypto.EncryptionAlgorithm,
|
||||
smtpEncryption crypto.EncryptionAlgorithm,
|
||||
smsEncryption crypto.EncryptionAlgorithm,
|
||||
@ -43,7 +44,7 @@ func Start(conf Config,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spool := spooler.StartSpooler(conf.Spooler, es, view, dbClient, command, queries, externalPort, externalSecure, dir, assetsPrefix, userEncryption, smtpEncryption, smsEncryption)
|
||||
spool := spooler.StartSpooler(conf.Spooler, es, view, dbClient, command, queries, externalPort, externalSecure, dir, assetsPrefix, fileSystemPath, userEncryption, smtpEncryption, smsEncryption)
|
||||
|
||||
return &EsRepository{
|
||||
spool,
|
||||
|
@ -29,7 +29,8 @@ func StartSpooler(c SpoolerConfig,
|
||||
externalPort uint16,
|
||||
externalSecure bool,
|
||||
dir http.FileSystem,
|
||||
assetsPrefix string,
|
||||
assetsPrefix,
|
||||
fileSystemPath string,
|
||||
userEncryption crypto.EncryptionAlgorithm,
|
||||
smtpEncryption crypto.EncryptionAlgorithm,
|
||||
smsEncryption crypto.EncryptionAlgorithm,
|
||||
@ -38,7 +39,7 @@ func StartSpooler(c SpoolerConfig,
|
||||
Eventstore: es,
|
||||
Locker: &locker{dbClient: sql},
|
||||
ConcurrentWorkers: c.ConcurrentWorkers,
|
||||
ViewHandlers: handler.Register(c.Handlers, c.BulkLimit, c.FailureCountUntilSkip, view, es, command, queries, externalPort, externalSecure, dir, assetsPrefix, userEncryption, smtpEncryption, smsEncryption),
|
||||
ViewHandlers: handler.Register(c.Handlers, c.BulkLimit, c.FailureCountUntilSkip, view, es, command, queries, externalPort, externalSecure, dir, assetsPrefix, fileSystemPath, userEncryption, smtpEncryption, smsEncryption),
|
||||
}
|
||||
spool := spoolerConfig.New()
|
||||
spool.Start()
|
||||
|
@ -31,14 +31,6 @@
|
||||
</style>
|
||||
<![endif]-->
|
||||
|
||||
<!--[if !mso]><!-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" rel="stylesheet" type="text/css">
|
||||
<style type="text/css">
|
||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700);
|
||||
</style>
|
||||
<!--<![endif]-->
|
||||
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
@media only screen and (min-width:480px) {
|
||||
@ -65,7 +57,7 @@
|
||||
{{if .FontURL}}
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: '{{.FontFamily}}';
|
||||
font-family: '{{.FontFaceFamily}}';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
src: url({{.FontURL}});
|
||||
@ -281,7 +273,7 @@
|
||||
align="center" bgcolor="{{.PrimaryColor}}" role="presentation" style="border:none;border-radius:6px;cursor:auto;mso-padding-alt:10px 25px;background:{{.PrimaryColor}};" valign="middle"
|
||||
>
|
||||
<a
|
||||
href="{{.URL}}" rel="noopener noreferrer" style="display:inline-block;background:{{.PrimaryColor}};color:#ffffff;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:14px;font-weight:500;line-height:120%;margin:0;text-decoration:none;text-transform:none;padding:10px 25px;mso-padding-alt:0px;border-radius:6px;" target="_blank"
|
||||
href="{{.URL}}" rel="noopener noreferrer" style="display:inline-block;background:{{.PrimaryColor}};color:#ffffff;font-family:{{.FontFamily}};font-size:14px;font-weight:500;line-height:120%;margin:0;text-decoration:none;text-transform:none;padding:10px 25px;mso-padding-alt:0px;border-radius:6px;" target="_blank"
|
||||
>
|
||||
{{.ButtonText}}
|
||||
</a>
|
||||
@ -369,4 +361,3 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -9,9 +9,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultFont = "http://fonts.googleapis.com/css?family=Lato:200,300,400,600"
|
||||
DefaultFontFamily = "-apple-system, BlinkMacSystemFont, Segoe UI, Lato, Arial, Helvetica, sans-serif"
|
||||
DefaultLogo = "https://static.zitadel.ch/zitadel-logo-dark@3x.png"
|
||||
DefaultFontColor = "#22292f"
|
||||
DefaultBackgroundColor = "#fafafa"
|
||||
DefaultPrimaryColor = "#5282C1"
|
||||
@ -30,6 +28,7 @@ type TemplateData struct {
|
||||
FontColor string
|
||||
LogoURL string
|
||||
FontURL string
|
||||
FontFaceFamily string
|
||||
FontFamily string
|
||||
|
||||
IncludeFooter bool
|
||||
|
@ -15,8 +15,6 @@ func GetTemplateData(translator *i18n.Translator, translateArgs map[string]inter
|
||||
PrimaryColor: templates.DefaultPrimaryColor,
|
||||
BackgroundColor: templates.DefaultBackgroundColor,
|
||||
FontColor: templates.DefaultFontColor,
|
||||
LogoURL: templates.DefaultLogo,
|
||||
FontURL: templates.DefaultFont,
|
||||
FontFamily: templates.DefaultFontFamily,
|
||||
IncludeFooter: false,
|
||||
}
|
||||
@ -33,14 +31,14 @@ func GetTemplateData(translator *i18n.Translator, translateArgs map[string]inter
|
||||
if assetsPrefix == "" {
|
||||
return templateData
|
||||
}
|
||||
templateData.LogoURL = ""
|
||||
if policy.Light.LogoURL != "" {
|
||||
templateData.LogoURL = fmt.Sprintf("%s/%s/%s", assetsPrefix, policy.ID, policy.Light.LogoURL)
|
||||
}
|
||||
if policy.FontURL != "" {
|
||||
split := strings.Split(policy.FontURL, "/")
|
||||
templateData.FontFamily = split[len(split)-1] + "," + templates.DefaultFontFamily
|
||||
templateData.FontFaceFamily = split[len(split)-1]
|
||||
templateData.FontURL = fmt.Sprintf("%s/%s/%s", assetsPrefix, policy.ID, policy.FontURL)
|
||||
templateData.FontFamily = templateData.FontFaceFamily + "," + templates.DefaultFontFamily
|
||||
}
|
||||
return templateData
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user