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
This commit is contained in:
Abhishek K 2024-08-27 17:07:21 +05:30 committed by GitHub
parent 0a1558d5ac
commit 9ac78e15bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) {