feat: request registration process by prompt (#1798)

* feat: request registration process by prompt

* fix merge

* add prompt create to docs
This commit is contained in:
Livio Amstutz
2021-06-14 10:40:38 +02:00
committed by GitHub
parent 770994e143
commit ab78b34c6c
9 changed files with 31 additions and 13 deletions

View File

@@ -3,10 +3,10 @@ package handler
import (
"net/http"
"github.com/caos/zitadel/internal/domain"
"golang.org/x/text/language"
http_mw "github.com/caos/zitadel/internal/api/http/middleware"
"github.com/caos/zitadel/internal/domain"
caos_errs "github.com/caos/zitadel/internal/errors"
)
@@ -82,7 +82,12 @@ func (l *Login) handleRegisterCheck(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, l.zitadelURL, http.StatusFound)
return
}
authRequest.LoginName = user.PreferredLoginName
userAgentID, _ := http_mw.UserAgentIDFromCtx(r.Context())
err = l.authRepo.SelectUser(r.Context(), authRequest.ID, user.AggregateID, userAgentID)
if err != nil {
l.renderRegister(w, r, authRequest, data, err)
return
}
l.renderNextStep(w, r, authRequest)
}

View File

@@ -8,18 +8,17 @@ import (
"path"
"strings"
"github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/static"
"github.com/caos/logging"
"github.com/gorilla/csrf"
"golang.org/x/text/language"
http_mw "github.com/caos/zitadel/internal/api/http/middleware"
"github.com/caos/zitadel/internal/auth_request/model"
"github.com/caos/zitadel/internal/domain"
caos_errs "github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/i18n"
"github.com/caos/zitadel/internal/renderer"
"github.com/caos/zitadel/internal/static"
)
const (
@@ -238,6 +237,8 @@ func (l *Login) chooseNextStep(w http.ResponseWriter, r *http.Request, authReq *
return
}
l.renderLogin(w, r, authReq, err)
case *domain.RegistrationStep:
l.renderRegisterOption(w, r, authReq, nil)
case *domain.SelectUserStep:
l.renderUserSelection(w, r, authReq, step)
case *domain.InitPasswordStep:

View File

@@ -22,9 +22,8 @@
formnovalidate>{{t "RegisterOption.RegisterUsernamePassword"}}</button>
{{end}}
<p>{{t "Registration.ExternalLogin"}}</p>
{{if .LoginPolicy.AllowExternalIDP}}
{{if hasExternalLogin}}
<p>{{t "Registration.ExternalLogin"}}</p>
{{ $reqid := .AuthReqID}}
{{range $provider := .IDPProviders}}
<a href="{{ externalIDPRegisterURL $reqid $provider.IDPConfigID}}"