Ver Fonte

NET-1227: Fix Singup Flow with Github SSO (#3078)

* add list roles to pro and ce

* if not pro set user role to admin

* validate update user

* add separate validation check for password on update

* remove validate check

* fix github SSO with invite signup
Abhishek K há 1 ano atrás
pai
commit
9ac78e15bc
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      pro/auth/github.go

+ 3 - 3
pro/auth/github.go

@@ -67,10 +67,9 @@ func handleGithubCallback(w http.ResponseWriter, r *http.Request) {
 		handleOauthNotConfigured(w)
 		return
 	}
-
 	var inviteExists bool
 	// check if invite exists for User
-	in, err := logic.GetUserInvite(content.Login)
+	in, err := logic.GetUserInvite(content.Email)
 	if err == nil {
 		inviteExists = true
 	}
@@ -89,11 +88,12 @@ func handleGithubCallback(w http.ResponseWriter, r *http.Request) {
 					logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
 					return
 				}
+				user.UserName = content.Login // overrides email with github id
 				if err = logic.CreateUser(&user); err != nil {
 					handleSomethingWentWrong(w)
 					return
 				}
-				logic.DeleteUserInvite(user.UserName)
+				logic.DeleteUserInvite(content.Email)
 				logic.DeletePendingUser(content.Login)
 			} else {
 				if !isEmailAllowed(content.Login) {