feat: passwordless registration (#2103)

* begin pw less registration

* create pwless one time codes

* send pwless link

* separate send and add passwordless link

* separate send and add passwordless link events

* custom message text for passwordless registration

* begin custom login texts for passwordless

* i18n

* i18n message

* i18n message

* custom message text

* custom login text

* org design and texts

* create link in human import process

* fix import human tests

* begin passwordless init required step

* passwordless init

* passwordless init

* do not return link in mgmt api

* prompt

* passwordless init only (no additional prompt)

* cleanup

* cleanup

* add passwordless prompt to custom login text

* increase init code complexity

* fix grpc

* cleanup

* fix and add some cases for nextStep tests

* fix tests

* Update internal/notification/static/i18n/en.yaml

* Update internal/notification/static/i18n/de.yaml

* Update proto/zitadel/management.proto

* Update internal/ui/login/static/i18n/de.yaml

* Update internal/ui/login/static/i18n/de.yaml

* Update internal/ui/login/static/i18n/de.yaml

Co-authored-by: Fabi <[email protected]>
This commit is contained in:
Livio Amstutz
2021-08-02 15:24:58 +02:00
committed by GitHub
co-authored by Fabi
parent 9b5cb38d62
commit 00220e9532
60 changed files with 2916 additions and 350 deletions
+180
View File
@@ -147,6 +147,24 @@ type CustomLoginTextReadModel struct {
PasswordlessNotSupported string
PasswordlessErrorRetry string
PasswordlessPromptTitle string
PasswordlessPromptDescription string
PasswordlessPromptDescriptionInit string
PasswordlessPromptPasswordlessButtonText string
PasswordlessPromptNextButtonText string
PasswordlessPromptSkipButtonText string
PasswordlessRegistrationTitle string
PasswordlessRegistrationDescription string
PasswordlessRegistrationRegisterTokenButtonText string
PasswordlessRegistrationTokenNameLabel string
PasswordlessRegistrationNotSupported string
PasswordlessRegistrationErrorRetry string
PasswordlessRegistrationDoneTitle string
PasswordlessRegistrationDoneDescription string
PasswordlessRegistrationDoneNextButtonText string
PasswordChangeTitle string
PasswordChangeDescription string
PasswordChangeOldPasswordLabel string
@@ -314,6 +332,18 @@ func (wm *CustomLoginTextReadModel) Reduce() error {
wm.handlePasswordlessScreenSetEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordlessPrompt) {
wm.handlePasswordlessPromptScreenSetEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordlessRegistration) {
wm.handlePasswordlessRegistrationScreenSetEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordlessRegistrationDone) {
wm.handlePasswordlessRegistrationDoneScreenSetEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordChange) {
wm.handlePasswordChangeScreenSetEvent(e)
continue
@@ -438,6 +468,18 @@ func (wm *CustomLoginTextReadModel) Reduce() error {
wm.handlePasswordlessScreenRemoveEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordlessPrompt) {
wm.handlePasswordlessPromptScreenRemoveEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordlessRegistration) {
wm.handlePasswordlessRegistrationScreenRemoveEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordlessRegistrationDone) {
wm.handlePasswordlessRegistrationDoneScreenRemoveEvent(e)
continue
}
if strings.HasPrefix(e.Key, domain.LoginKeyPasswordChange) {
wm.handlePasswordChangeScreenRemoveEvent(e)
continue
@@ -1489,6 +1531,144 @@ func (wm *CustomLoginTextReadModel) handlePasswordlessScreenRemoveEvent(e *polic
}
}
func (wm *CustomLoginTextReadModel) handlePasswordlessPromptScreenSetEvent(e *policy.CustomTextSetEvent) {
if e.Key == domain.LoginKeyPasswordlessPromptTitle {
wm.PasswordlessPromptTitle = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessPromptDescription {
wm.PasswordlessPromptDescription = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessPromptDescriptionInit {
wm.PasswordlessPromptDescriptionInit = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessPromptPasswordlessButtonText {
wm.PasswordlessPromptPasswordlessButtonText = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessPromptNextButtonText {
wm.PasswordlessPromptNextButtonText = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessPromptSkipButtonText {
wm.PasswordlessPromptSkipButtonText = e.Text
return
}
}
func (wm *CustomLoginTextReadModel) handlePasswordlessPromptScreenRemoveEvent(e *policy.CustomTextRemovedEvent) {
if e.Key == domain.LoginKeyPasswordlessPromptTitle {
wm.PasswordlessPromptTitle = ""
return
}
if e.Key == domain.LoginKeyPasswordlessPromptDescription {
wm.PasswordlessPromptDescription = ""
return
}
if e.Key == domain.LoginKeyPasswordlessPromptDescriptionInit {
wm.PasswordlessPromptDescriptionInit = ""
return
}
if e.Key == domain.LoginKeyPasswordlessPromptPasswordlessButtonText {
wm.PasswordlessPromptPasswordlessButtonText = ""
return
}
if e.Key == domain.LoginKeyPasswordlessPromptNextButtonText {
wm.PasswordlessPromptNextButtonText = ""
return
}
if e.Key == domain.LoginKeyPasswordlessPromptSkipButtonText {
wm.PasswordlessPromptSkipButtonText = ""
return
}
}
func (wm *CustomLoginTextReadModel) handlePasswordlessRegistrationScreenSetEvent(e *policy.CustomTextSetEvent) {
if e.Key == domain.LoginKeyPasswordlessRegistrationTitle {
wm.PasswordlessRegistrationTitle = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationDescription {
wm.PasswordlessRegistrationDescription = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationRegisterTokenButtonText {
wm.PasswordlessRegistrationRegisterTokenButtonText = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationTokenNameLabel {
wm.PasswordlessRegistrationTokenNameLabel = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationNotSupported {
wm.PasswordlessRegistrationNotSupported = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationErrorRetry {
wm.PasswordlessRegistrationErrorRetry = e.Text
return
}
}
func (wm *CustomLoginTextReadModel) handlePasswordlessRegistrationScreenRemoveEvent(e *policy.CustomTextRemovedEvent) {
if e.Key == domain.LoginKeyPasswordlessRegistrationTitle {
wm.PasswordlessRegistrationTitle = ""
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationDescription {
wm.PasswordlessRegistrationDescription = ""
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationRegisterTokenButtonText {
wm.PasswordlessRegistrationRegisterTokenButtonText = ""
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationTokenNameLabel {
wm.PasswordlessRegistrationTokenNameLabel = ""
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationNotSupported {
wm.PasswordlessRegistrationNotSupported = ""
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationErrorRetry {
wm.PasswordlessRegistrationErrorRetry = ""
return
}
}
func (wm *CustomLoginTextReadModel) handlePasswordlessRegistrationDoneScreenSetEvent(e *policy.CustomTextSetEvent) {
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneTitle {
wm.PasswordlessRegistrationDoneTitle = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneDescription {
wm.PasswordlessRegistrationDoneDescription = e.Text
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneNextButtonText {
wm.PasswordlessRegistrationDoneNextButtonText = e.Text
return
}
}
func (wm *CustomLoginTextReadModel) handlePasswordlessRegistrationDoneScreenRemoveEvent(e *policy.CustomTextRemovedEvent) {
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneTitle {
wm.PasswordlessRegistrationDoneTitle = ""
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneDescription {
wm.PasswordlessRegistrationDoneDescription = ""
return
}
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneNextButtonText {
wm.PasswordlessRegistrationDoneNextButtonText = ""
return
}
}
func (wm *CustomLoginTextReadModel) handlePasswordChangeScreenSetEvent(e *policy.CustomTextSetEvent) {
if e.Key == domain.LoginKeyPasswordChangeTitle {
wm.PasswordChangeTitle = e.Text