fix: panics (#2993)

* add missing return

Signed-off-by: Livio Amstutz <livio.a@gmail.com>

* add nil pointer check

Signed-off-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Livio Amstutz 2022-01-12 15:31:11 +01:00 committed by GitHub
parent 6240dffc42
commit 3d14653a08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ func (l *Login) handleLoginSuccess(w http.ResponseWriter, r *http.Request) {
authRequest, _ := l.getAuthRequest(r)
if authRequest == nil {
l.renderSuccessAndCallback(w, r, nil, nil)
return
}
for _, step := range authRequest.PossibleSteps {
if step.Type() != domain.NextStepLoginSucceeded && step.Type() != domain.NextStepRedirectToCallback {

View File

@ -70,7 +70,7 @@ func (l *Login) handleRegisterCheck(w http.ResponseWriter, r *http.Request) {
resourceOwner := iam.GlobalOrgID
memberRoles := []string{domain.RoleSelfManagementGlobal}
if authRequest.RequestedOrgID != "" && authRequest.RequestedOrgID != iam.GlobalOrgID {
if authRequest != nil && authRequest.RequestedOrgID != "" && authRequest.RequestedOrgID != iam.GlobalOrgID {
memberRoles = nil
resourceOwner = authRequest.RequestedOrgID
}