2022-04-12 14:20:17 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/command/preparation"
|
|
|
|
"github.com/zitadel/zitadel/internal/crypto"
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
2022-04-12 14:20:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Email struct {
|
2023-03-14 19:20:38 +00:00
|
|
|
Address domain.EmailAddress
|
2022-04-12 14:20:17 +00:00
|
|
|
Verified bool
|
2023-04-26 05:47:57 +00:00
|
|
|
|
|
|
|
// ReturnCode is used if the Verified field is false
|
|
|
|
ReturnCode bool
|
|
|
|
|
|
|
|
// URLTemplate can be used to specify a custom link to be sent in the mail verification
|
|
|
|
URLTemplate string
|
2022-04-12 14:20:17 +00:00
|
|
|
}
|
|
|
|
|
2023-03-14 19:20:38 +00:00
|
|
|
func (e *Email) Validate() error {
|
|
|
|
return e.Address.Validate()
|
2022-04-12 14:20:17 +00:00
|
|
|
}
|
|
|
|
|
2023-07-10 08:07:10 +00:00
|
|
|
func (c *Commands) newEmailCode(ctx context.Context, filter preparation.FilterToQueryReducer, alg crypto.EncryptionAlgorithm) (*CryptoCode, error) {
|
2023-05-24 10:22:00 +00:00
|
|
|
return c.newCode(ctx, filter, domain.SecretGeneratorTypeVerifyEmailCode, alg)
|
2022-04-12 14:20:17 +00:00
|
|
|
}
|