mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:37:31 +00:00
feat(api): add otp (sms and email) checks in session api (#6422)
* feat: add otp (sms and email) checks in session api * implement sending * fix tests * add tests * add integration tests * fix merge main and add tests * put default OTP Email url into config --------- Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
type SessionState int32
|
||||
|
||||
const (
|
||||
@@ -7,3 +13,23 @@ const (
|
||||
SessionStateActive
|
||||
SessionStateTerminated
|
||||
)
|
||||
|
||||
type OTPEmailURLData struct {
|
||||
Code string
|
||||
UserID string
|
||||
LoginName string
|
||||
DisplayName string
|
||||
PreferredLanguage language.Tag
|
||||
}
|
||||
|
||||
// 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 string, preferredLanguage language.Tag) error {
|
||||
return renderURLTemplate(w, tmpl, &OTPEmailURLData{
|
||||
Code: code,
|
||||
UserID: userID,
|
||||
LoginName: loginName,
|
||||
DisplayName: displayName,
|
||||
PreferredLanguage: preferredLanguage,
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user