feat: disable user signup

This commit is contained in:
Anik Ghosh
2022-03-16 22:49:18 +05:30
parent 21fef67c7d
commit 96edb43b67
15 changed files with 144 additions and 1 deletions

View File

@@ -71,6 +71,10 @@ func OAuthCallbackHandler() gin.HandlerFunc {
existingUser, err := db.Provider.GetUserByEmail(user.Email)
if err != nil {
if envstore.EnvStoreObj.GetBoolStoreEnvVariable(constants.EnvKeyDisableSignUp) {
c.JSON(400, gin.H{"error": "signup is disabled for this instance"})
return
}
// user not registered, register user and generate session token
user.SignupMethods = provider
// make sure inputRoles don't include protected roles