Block Oauth when signup is disabled

This commit is contained in:
Thomas Miceli 2023-04-17 20:33:24 +02:00
parent 2d42cf798c
commit 6a0fd92516
No known key found for this signature in database
GPG key ID: D86C6F6390AF050F

View file

@ -162,6 +162,10 @@ func oauthCallback(ctx echo.Context) error {
}
if err = userDB.Create(); err != nil {
if getData(ctx, "signupDisabled") == true {
return errorRes(403, "Signing up is disabled", nil)
}
if models.IsUniqueConstraintViolation(err) {
addFlash(ctx, "Username "+user.NickName+" already exists in Opengist", "error")
return redirect(ctx, "/login")