Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Github & Gitea OAuth provider #13

Merged
merged 6 commits into from
Apr 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Block Oauth when signup is disabled
  • Loading branch information
thomiceli committed Apr 17, 2023
commit 6a0fd92516a6dbad3cde3250ea967187910b6a9a
4 changes: 4 additions & 0 deletions internal/web/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down