mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-08 18:37:39 +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)
|
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()
|
router := mux.NewRouter()
|
||||||
err = startAPIs(ctx, router, commands, queries, eventstoreClient, dbClient, config, storage, authZRepo, keys)
|
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
|
package hook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
@ -20,6 +21,6 @@ func Base64ToBytesHookFunc() mapstructure.DecodeHookFuncType {
|
|||||||
return data, nil
|
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,
|
command *command.Commands,
|
||||||
queries *query.Queries,
|
queries *query.Queries,
|
||||||
dbClient *sql.DB,
|
dbClient *sql.DB,
|
||||||
assetsPrefix string,
|
assetsPrefix,
|
||||||
|
fileSystemPath string,
|
||||||
userEncryption crypto.EncryptionAlgorithm,
|
userEncryption crypto.EncryptionAlgorithm,
|
||||||
smtpEncryption crypto.EncryptionAlgorithm,
|
smtpEncryption crypto.EncryptionAlgorithm,
|
||||||
smsEncryption crypto.EncryptionAlgorithm,
|
smsEncryption crypto.EncryptionAlgorithm,
|
||||||
@ -32,6 +33,6 @@ func Start(config Config,
|
|||||||
statikFS, err := fs.NewWithNamespace("notification")
|
statikFS, err := fs.NewWithNamespace("notification")
|
||||||
logging.OnError(err).Panic("unable to start listener")
|
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")
|
logging.OnError(err).Panic("unable to start app")
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ func Register(configs Configs,
|
|||||||
externalPort uint16,
|
externalPort uint16,
|
||||||
externalSecure bool,
|
externalSecure bool,
|
||||||
dir http.FileSystem,
|
dir http.FileSystem,
|
||||||
assetsPrefix string,
|
assetsPrefix,
|
||||||
|
fileSystemPath string,
|
||||||
userEncryption crypto.EncryptionAlgorithm,
|
userEncryption crypto.EncryptionAlgorithm,
|
||||||
smtpEncryption crypto.EncryptionAlgorithm,
|
smtpEncryption crypto.EncryptionAlgorithm,
|
||||||
smsEncryption crypto.EncryptionAlgorithm,
|
smsEncryption crypto.EncryptionAlgorithm,
|
||||||
@ -59,6 +60,7 @@ func Register(configs Configs,
|
|||||||
externalSecure,
|
externalSecure,
|
||||||
dir,
|
dir,
|
||||||
assetsPrefix,
|
assetsPrefix,
|
||||||
|
fileSystemPath,
|
||||||
userEncryption,
|
userEncryption,
|
||||||
smtpEncryption,
|
smtpEncryption,
|
||||||
smsEncryption,
|
smsEncryption,
|
||||||
|
@ -59,7 +59,8 @@ func newNotification(
|
|||||||
externalPort uint16,
|
externalPort uint16,
|
||||||
externalSecure bool,
|
externalSecure bool,
|
||||||
statikDir http.FileSystem,
|
statikDir http.FileSystem,
|
||||||
assetsPrefix string,
|
assetsPrefix,
|
||||||
|
fileSystemPath string,
|
||||||
userEncryption crypto.EncryptionAlgorithm,
|
userEncryption crypto.EncryptionAlgorithm,
|
||||||
smtpEncryption crypto.EncryptionAlgorithm,
|
smtpEncryption crypto.EncryptionAlgorithm,
|
||||||
smsEncryption crypto.EncryptionAlgorithm,
|
smsEncryption crypto.EncryptionAlgorithm,
|
||||||
@ -75,6 +76,7 @@ func newNotification(
|
|||||||
smsTokenCrypto: smsEncryption,
|
smsTokenCrypto: smsEncryption,
|
||||||
externalSecure: externalSecure,
|
externalSecure: externalSecure,
|
||||||
externalPort: externalPort,
|
externalPort: externalPort,
|
||||||
|
fileSystemPath: fileSystemPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
h.subscribe()
|
h.subscribe()
|
||||||
|
@ -28,7 +28,8 @@ func Start(conf Config,
|
|||||||
command *command.Commands,
|
command *command.Commands,
|
||||||
queries *query.Queries,
|
queries *query.Queries,
|
||||||
dbClient *sql.DB,
|
dbClient *sql.DB,
|
||||||
assetsPrefix string,
|
assetsPrefix,
|
||||||
|
fileSystemPath string,
|
||||||
userEncryption crypto.EncryptionAlgorithm,
|
userEncryption crypto.EncryptionAlgorithm,
|
||||||
smtpEncryption crypto.EncryptionAlgorithm,
|
smtpEncryption crypto.EncryptionAlgorithm,
|
||||||
smsEncryption crypto.EncryptionAlgorithm,
|
smsEncryption crypto.EncryptionAlgorithm,
|
||||||
@ -43,7 +44,7 @@ func Start(conf Config,
|
|||||||
return nil, err
|
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{
|
return &EsRepository{
|
||||||
spool,
|
spool,
|
||||||
|
@ -29,7 +29,8 @@ func StartSpooler(c SpoolerConfig,
|
|||||||
externalPort uint16,
|
externalPort uint16,
|
||||||
externalSecure bool,
|
externalSecure bool,
|
||||||
dir http.FileSystem,
|
dir http.FileSystem,
|
||||||
assetsPrefix string,
|
assetsPrefix,
|
||||||
|
fileSystemPath string,
|
||||||
userEncryption crypto.EncryptionAlgorithm,
|
userEncryption crypto.EncryptionAlgorithm,
|
||||||
smtpEncryption crypto.EncryptionAlgorithm,
|
smtpEncryption crypto.EncryptionAlgorithm,
|
||||||
smsEncryption crypto.EncryptionAlgorithm,
|
smsEncryption crypto.EncryptionAlgorithm,
|
||||||
@ -38,7 +39,7 @@ func StartSpooler(c SpoolerConfig,
|
|||||||
Eventstore: es,
|
Eventstore: es,
|
||||||
Locker: &locker{dbClient: sql},
|
Locker: &locker{dbClient: sql},
|
||||||
ConcurrentWorkers: c.ConcurrentWorkers,
|
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 := spoolerConfig.New()
|
||||||
spool.Start()
|
spool.Start()
|
||||||
|
@ -31,14 +31,6 @@
|
|||||||
</style>
|
</style>
|
||||||
<![endif]-->
|
<![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">
|
<style type="text/css">
|
||||||
@media only screen and (min-width:480px) {
|
@media only screen and (min-width:480px) {
|
||||||
@ -65,7 +57,7 @@
|
|||||||
{{if .FontURL}}
|
{{if .FontURL}}
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: '{{.FontFamily}}';
|
font-family: '{{.FontFaceFamily}}';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
src: url({{.FontURL}});
|
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"
|
align="center" bgcolor="{{.PrimaryColor}}" role="presentation" style="border:none;border-radius:6px;cursor:auto;mso-padding-alt:10px 25px;background:{{.PrimaryColor}};" valign="middle"
|
||||||
>
|
>
|
||||||
<a
|
<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}}
|
{{.ButtonText}}
|
||||||
</a>
|
</a>
|
||||||
@ -369,4 +361,3 @@
|
|||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -9,9 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultFont = "http://fonts.googleapis.com/css?family=Lato:200,300,400,600"
|
|
||||||
DefaultFontFamily = "-apple-system, BlinkMacSystemFont, Segoe UI, Lato, Arial, Helvetica, sans-serif"
|
DefaultFontFamily = "-apple-system, BlinkMacSystemFont, Segoe UI, Lato, Arial, Helvetica, sans-serif"
|
||||||
DefaultLogo = "https://static.zitadel.ch/zitadel-logo-dark@3x.png"
|
|
||||||
DefaultFontColor = "#22292f"
|
DefaultFontColor = "#22292f"
|
||||||
DefaultBackgroundColor = "#fafafa"
|
DefaultBackgroundColor = "#fafafa"
|
||||||
DefaultPrimaryColor = "#5282C1"
|
DefaultPrimaryColor = "#5282C1"
|
||||||
@ -30,6 +28,7 @@ type TemplateData struct {
|
|||||||
FontColor string
|
FontColor string
|
||||||
LogoURL string
|
LogoURL string
|
||||||
FontURL string
|
FontURL string
|
||||||
|
FontFaceFamily string
|
||||||
FontFamily string
|
FontFamily string
|
||||||
|
|
||||||
IncludeFooter bool
|
IncludeFooter bool
|
||||||
|
@ -15,8 +15,6 @@ func GetTemplateData(translator *i18n.Translator, translateArgs map[string]inter
|
|||||||
PrimaryColor: templates.DefaultPrimaryColor,
|
PrimaryColor: templates.DefaultPrimaryColor,
|
||||||
BackgroundColor: templates.DefaultBackgroundColor,
|
BackgroundColor: templates.DefaultBackgroundColor,
|
||||||
FontColor: templates.DefaultFontColor,
|
FontColor: templates.DefaultFontColor,
|
||||||
LogoURL: templates.DefaultLogo,
|
|
||||||
FontURL: templates.DefaultFont,
|
|
||||||
FontFamily: templates.DefaultFontFamily,
|
FontFamily: templates.DefaultFontFamily,
|
||||||
IncludeFooter: false,
|
IncludeFooter: false,
|
||||||
}
|
}
|
||||||
@ -33,14 +31,14 @@ func GetTemplateData(translator *i18n.Translator, translateArgs map[string]inter
|
|||||||
if assetsPrefix == "" {
|
if assetsPrefix == "" {
|
||||||
return templateData
|
return templateData
|
||||||
}
|
}
|
||||||
templateData.LogoURL = ""
|
|
||||||
if policy.Light.LogoURL != "" {
|
if policy.Light.LogoURL != "" {
|
||||||
templateData.LogoURL = fmt.Sprintf("%s/%s/%s", assetsPrefix, policy.ID, policy.Light.LogoURL)
|
templateData.LogoURL = fmt.Sprintf("%s/%s/%s", assetsPrefix, policy.ID, policy.Light.LogoURL)
|
||||||
}
|
}
|
||||||
if policy.FontURL != "" {
|
if policy.FontURL != "" {
|
||||||
split := strings.Split(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.FontURL = fmt.Sprintf("%s/%s/%s", assetsPrefix, policy.ID, policy.FontURL)
|
||||||
|
templateData.FontFamily = templateData.FontFaceFamily + "," + templates.DefaultFontFamily
|
||||||
}
|
}
|
||||||
return templateData
|
return templateData
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user