mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
16171ce3b9
# Which Problems Are Solved OTP Email links currently could not use / include the sessionID they belong to. This prevents an easy use for redirecting and handling OTP via email through the session API. # How the Problems Are Solved Added the sessionID as placeholder for the OTP Email link template. # Additional Changes List all available placeholders in the url_templates of V2 endpoints. # Additional Context - discussed in a customer meeting
38 lines
951 B
Go
38 lines
951 B
Go
package domain
|
|
|
|
import (
|
|
"io"
|
|
|
|
"golang.org/x/text/language"
|
|
)
|
|
|
|
type SessionState int32
|
|
|
|
const (
|
|
SessionStateUnspecified SessionState = iota
|
|
SessionStateActive
|
|
SessionStateTerminated
|
|
)
|
|
|
|
type OTPEmailURLData struct {
|
|
Code string
|
|
UserID string
|
|
LoginName string
|
|
DisplayName string
|
|
PreferredLanguage language.Tag
|
|
SessionID string
|
|
}
|
|
|
|
// RenderOTPEmailURLTemplate parses and renders tmpl.
|
|
// code, userID, (preferred) loginName, displayName and preferredLanguage are passed into the [OTPEmailURLData].
|
|
func RenderOTPEmailURLTemplate(w io.Writer, tmpl, code, userID, loginName, displayName, sessionID string, preferredLanguage language.Tag) error {
|
|
return renderURLTemplate(w, tmpl, &OTPEmailURLData{
|
|
Code: code,
|
|
UserID: userID,
|
|
LoginName: loginName,
|
|
DisplayName: displayName,
|
|
PreferredLanguage: preferredLanguage,
|
|
SessionID: sessionID,
|
|
})
|
|
}
|