mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-23 04:52:40 +00:00
Block Oauth when signup is disabled
This commit is contained in:
parent
2d42cf798c
commit
6a0fd92516
1 changed files with 4 additions and 0 deletions
|
@ -162,6 +162,10 @@ func oauthCallback(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = userDB.Create(); err != nil {
|
if err = userDB.Create(); err != nil {
|
||||||
|
if getData(ctx, "signupDisabled") == true {
|
||||||
|
return errorRes(403, "Signing up is disabled", nil)
|
||||||
|
}
|
||||||
|
|
||||||
if models.IsUniqueConstraintViolation(err) {
|
if models.IsUniqueConstraintViolation(err) {
|
||||||
addFlash(ctx, "Username "+user.NickName+" already exists in Opengist", "error")
|
addFlash(ctx, "Username "+user.NickName+" already exists in Opengist", "error")
|
||||||
return redirect(ctx, "/login")
|
return redirect(ctx, "/login")
|
||||||
|
|
Loading…
Reference in a new issue