mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
fix: user registration through IdP (#7893)
* fix: user registration through idp * fix more nil pointer issues
This commit is contained in:
parent
83c5066ab9
commit
482a46b198
@ -104,16 +104,17 @@ func (l *Login) checkUserInitCode(w http.ResponseWriter, r *http.Request, authRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *Login) resendUserInit(w http.ResponseWriter, r *http.Request, authReq *domain.AuthRequest, userID string, loginName string, showPassword bool) {
|
func (l *Login) resendUserInit(w http.ResponseWriter, r *http.Request, authReq *domain.AuthRequest, userID string, loginName string, showPassword bool) {
|
||||||
userOrgID := ""
|
var userOrgID, authRequestID string
|
||||||
if authReq != nil {
|
if authReq != nil {
|
||||||
userOrgID = authReq.UserOrgID
|
userOrgID = authReq.UserOrgID
|
||||||
|
authRequestID = authReq.ID
|
||||||
}
|
}
|
||||||
initCodeGenerator, err := l.query.InitEncryptionGenerator(r.Context(), domain.SecretGeneratorTypeInitCode, l.userCodeAlg)
|
initCodeGenerator, err := l.query.InitEncryptionGenerator(r.Context(), domain.SecretGeneratorTypeInitCode, l.userCodeAlg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.renderInitUser(w, r, authReq, userID, loginName, "", showPassword, err)
|
l.renderInitUser(w, r, authReq, userID, loginName, "", showPassword, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err = l.command.ResendInitialMail(setContext(r.Context(), userOrgID), userID, "", userOrgID, initCodeGenerator, authReq.ID)
|
_, err = l.command.ResendInitialMail(setContext(r.Context(), userOrgID), userID, "", userOrgID, initCodeGenerator, authRequestID)
|
||||||
l.renderInitUser(w, r, authReq, userID, loginName, "", showPassword, err)
|
l.renderInitUser(w, r, authReq, userID, loginName, "", showPassword, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ func (l *Login) renderOTPVerification(w http.ResponseWriter, r *http.Request, au
|
|||||||
func (l *Login) handleOTPVerificationCheck(w http.ResponseWriter, r *http.Request) {
|
func (l *Login) handleOTPVerificationCheck(w http.ResponseWriter, r *http.Request) {
|
||||||
formData := new(mfaOTPFormData)
|
formData := new(mfaOTPFormData)
|
||||||
authReq, err := l.getAuthRequestAndParseData(r, formData)
|
authReq, err := l.getAuthRequestAndParseData(r, formData)
|
||||||
if err != nil {
|
if authReq == nil || err != nil {
|
||||||
l.renderError(w, r, authReq, err)
|
l.renderError(w, r, authReq, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -689,16 +689,17 @@ func AddHumanFromDomain(user *domain.Human, metadataList []*domain.Metadata, aut
|
|||||||
human.DisplayName = user.DisplayName
|
human.DisplayName = user.DisplayName
|
||||||
human.PreferredLanguage = user.PreferredLanguage
|
human.PreferredLanguage = user.PreferredLanguage
|
||||||
human.Gender = user.Gender
|
human.Gender = user.Gender
|
||||||
human.Password = user.Password.SecretString
|
|
||||||
human.Register = true
|
human.Register = true
|
||||||
human.Metadata = addMetadata
|
human.Metadata = addMetadata
|
||||||
|
}
|
||||||
|
if authRequest != nil {
|
||||||
human.UserAgentID = authRequest.AgentID
|
human.UserAgentID = authRequest.AgentID
|
||||||
human.AuthRequestID = authRequest.ID
|
human.AuthRequestID = authRequest.ID
|
||||||
}
|
}
|
||||||
if user.Email != nil {
|
if user.Email != nil {
|
||||||
human.Email = Email{
|
human.Email = Email{
|
||||||
Address: user.EmailAddress,
|
Address: user.Email.EmailAddress,
|
||||||
Verified: user.IsEmailVerified,
|
Verified: user.Email.IsEmailVerified,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if user.Phone != nil {
|
if user.Phone != nil {
|
||||||
@ -707,6 +708,9 @@ func AddHumanFromDomain(user *domain.Human, metadataList []*domain.Metadata, aut
|
|||||||
Verified: user.Phone.IsPhoneVerified,
|
Verified: user.Phone.IsPhoneVerified,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if user.Password != nil {
|
||||||
|
human.Password = user.Password.SecretString
|
||||||
|
}
|
||||||
if idp != nil {
|
if idp != nil {
|
||||||
human.Links = []*AddLink{
|
human.Links = []*AddLink{
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user