mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-06 09:12:19 +00:00
fix: configure default url templates (#10416)
# Which Problems Are Solved
Emails are still send only with URLs to login v1.
# How the Problems Are Solved
Add configuration for URLs as URL templates, so that links can point at
Login v2.
# Additional Changes
None
# Additional Context
Closes #10236
---------
Co-authored-by: Marco A. <marco@zitadel.com>
(cherry picked from commit 0a14c01412)
This commit is contained in:
committed by
Livio Spring
parent
e06df6e161
commit
1625e5f7bc
@@ -43,6 +43,7 @@ func TestCommandSide_AddUserHuman(t *testing.T) {
|
||||
newEncryptedCodeWithDefault encryptedCodeWithDefaultFunc
|
||||
checkPermission domain.PermissionCheck
|
||||
defaultSecretGenerators *SecretGenerators
|
||||
defaultEmailCodeURLTemplate func(ctx context.Context) string
|
||||
}
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
@@ -494,15 +495,16 @@ func TestCommandSide_AddUserHuman(t *testing.T) {
|
||||
Crypted: []byte("emailverify"),
|
||||
},
|
||||
1*time.Hour,
|
||||
"",
|
||||
"http://example.com/{{.user}}/email/{{.code}}",
|
||||
false,
|
||||
"",
|
||||
),
|
||||
),
|
||||
),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
idGenerator: id_mock.NewIDGeneratorExpectIDs(t, "user1"),
|
||||
newCode: mockEncryptedCode("emailverify", time.Hour),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
idGenerator: id_mock.NewIDGeneratorExpectIDs(t, "user1"),
|
||||
newCode: mockEncryptedCode("emailverify", time.Hour),
|
||||
defaultEmailCodeURLTemplate: func(ctx context.Context) string { return "http://example.com/{{.user}}/email/{{.code}}" },
|
||||
},
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
@@ -639,16 +641,17 @@ func TestCommandSide_AddUserHuman(t *testing.T) {
|
||||
Crypted: []byte("emailCode"),
|
||||
},
|
||||
1*time.Hour,
|
||||
"",
|
||||
"http://example.com/{{.user}}/email/{{.code}}",
|
||||
true,
|
||||
"",
|
||||
),
|
||||
),
|
||||
),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
idGenerator: id_mock.NewIDGeneratorExpectIDs(t, "user1"),
|
||||
userPasswordHasher: mockPasswordHasher("x"),
|
||||
newCode: mockEncryptedCode("emailCode", time.Hour),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
idGenerator: id_mock.NewIDGeneratorExpectIDs(t, "user1"),
|
||||
userPasswordHasher: mockPasswordHasher("x"),
|
||||
newCode: mockEncryptedCode("emailCode", time.Hour),
|
||||
defaultEmailCodeURLTemplate: func(ctx context.Context) string { return "http://example.com/{{.user}}/email/{{.code}}" },
|
||||
},
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
@@ -1501,7 +1504,7 @@ func TestCommandSide_AddUserHuman(t *testing.T) {
|
||||
),
|
||||
expectPush(
|
||||
newRegisterHumanEvent("email@test.ch", "", false, true, "", language.English),
|
||||
user.NewHumanEmailCodeAddedEvent(
|
||||
user.NewHumanEmailCodeAddedEventV2(
|
||||
context.Background(),
|
||||
&userAgg.Aggregate,
|
||||
&crypto.CryptoValue{
|
||||
@@ -1511,6 +1514,8 @@ func TestCommandSide_AddUserHuman(t *testing.T) {
|
||||
Crypted: []byte("mailVerify"),
|
||||
},
|
||||
time.Hour,
|
||||
"http://example.com/{{.user}}/email/{{.code}}",
|
||||
false,
|
||||
"authRequestID",
|
||||
),
|
||||
user.NewUserIDPLinkAddedEvent(
|
||||
@@ -1522,9 +1527,10 @@ func TestCommandSide_AddUserHuman(t *testing.T) {
|
||||
),
|
||||
),
|
||||
),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
idGenerator: id_mock.NewIDGeneratorExpectIDs(t, "user1"),
|
||||
newCode: mockEncryptedCode("mailVerify", time.Hour),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
idGenerator: id_mock.NewIDGeneratorExpectIDs(t, "user1"),
|
||||
newCode: mockEncryptedCode("mailVerify", time.Hour),
|
||||
defaultEmailCodeURLTemplate: func(ctx context.Context) string { return "http://example.com/{{.user}}/email/{{.code}}" },
|
||||
},
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
@@ -2055,6 +2061,7 @@ func TestCommandSide_AddUserHuman(t *testing.T) {
|
||||
CryptoMFA: cryptoAlg,
|
||||
},
|
||||
},
|
||||
defaultEmailCodeURLTemplate: tt.fields.defaultEmailCodeURLTemplate,
|
||||
}
|
||||
err := r.AddUserHuman(tt.args.ctx, tt.args.orgID, tt.args.human, tt.args.allowInitMail, tt.args.codeAlg)
|
||||
if tt.res.err == nil {
|
||||
@@ -2092,6 +2099,7 @@ func TestCommandSide_ChangeUserHuman(t *testing.T) {
|
||||
newEncryptedCodeWithDefault encryptedCodeWithDefaultFunc
|
||||
checkPermission domain.PermissionCheck
|
||||
defaultSecretGenerators *SecretGenerators
|
||||
defaultEmailCodeURLTemplate func(ctx context.Context) string
|
||||
}
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
@@ -2398,14 +2406,15 @@ func TestCommandSide_ChangeUserHuman(t *testing.T) {
|
||||
Crypted: []byte("emailCode"),
|
||||
},
|
||||
time.Hour,
|
||||
"",
|
||||
"http://example.com/{{.user}}/email/{{.code}}",
|
||||
false,
|
||||
"",
|
||||
),
|
||||
),
|
||||
),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
newCode: mockEncryptedCode("emailCode", time.Hour),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
newCode: mockEncryptedCode("emailCode", time.Hour),
|
||||
defaultEmailCodeURLTemplate: func(ctx context.Context) string { return "http://example.com/{{.user}}/email/{{.code}}" },
|
||||
},
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
@@ -2578,14 +2587,15 @@ func TestCommandSide_ChangeUserHuman(t *testing.T) {
|
||||
Crypted: []byte("emailCode"),
|
||||
},
|
||||
time.Hour,
|
||||
"",
|
||||
"http://example.com/{{.user}}/email/{{.code}}",
|
||||
true,
|
||||
"",
|
||||
),
|
||||
),
|
||||
),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
newCode: mockEncryptedCode("emailCode", time.Hour),
|
||||
checkPermission: newMockPermissionCheckAllowed(),
|
||||
newCode: mockEncryptedCode("emailCode", time.Hour),
|
||||
defaultEmailCodeURLTemplate: func(ctx context.Context) string { return "http://example.com/{{.user}}/email/{{.code}}" },
|
||||
},
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
@@ -3590,6 +3600,7 @@ func TestCommandSide_ChangeUserHuman(t *testing.T) {
|
||||
checkPermission: tt.fields.checkPermission,
|
||||
defaultSecretGenerators: tt.fields.defaultSecretGenerators,
|
||||
userEncryption: tt.args.codeAlg,
|
||||
defaultEmailCodeURLTemplate: tt.fields.defaultEmailCodeURLTemplate,
|
||||
}
|
||||
err := r.ChangeUserHuman(tt.args.ctx, tt.args.human, tt.args.codeAlg)
|
||||
if tt.res.err == nil {
|
||||
|
||||
Reference in New Issue
Block a user