You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/models
Martin Michaelis 55eb1745bd
OAuth2 auto-register (#5123)
* Refactored handleOAuth2SignIn in routers/user/auth.go

The function handleOAuth2SignIn was called twice but some code path could only
be reached by one of the invocations. Moved the unnecessary code path out of
handleOAuth2SignIn.


* Refactored user creation

There was common code to create a user and display the correct error message.
And after the creation the only user should be an admin and if enabled a
confirmation email should be sent. This common code is now abstracted into
two functions and a helper function to call both.

* Added auto-register for OAuth2 users

If enabled new OAuth2 users will be registered with their OAuth2 details.
The UserID, Name and Email fields from the gothUser are used.
Therefore the OpenID Connect provider needs additional scopes to return
the coresponding claims.

* Added error for missing fields in OAuth2 response

* Linking and auto linking on oauth2 registration

* Set default username source to nickname

* Add automatic oauth2 scopes for github and google

* Add hint to change the openid connect scopes if fields are missing

* Extend info about auto linking security risk

Co-authored-by: Viktor Kuzmin <kvaster@gmail.com>
Signed-off-by: Martin Michaelis <code@mgjm.de>
3 years ago
..
fixtures API: fix set milestone on PR creation (#14981) 3 years ago
migrations OAuth2 auto-register (#5123) 3 years ago
access.go chore(models): rewrite code format. (#14754) 3 years ago
access_test.go Fix "access" fixtures and tests (#10247) 4 years ago
action.go Fix timezone bug when clicking heatmap (#15141) 3 years ago
action_list.go refactor: reduce sql query in retrieveFeeds (#3547) 6 years ago
action_test.go Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL (#12999) 3 years ago
admin.go chore(models): rewrite code format. (#14754) 3 years ago
admin_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
attachment.go Add size to Save function (#15264) 3 years ago
attachment_test.go Implement delete release attachments and update release attachments' name (#14130) 3 years ago
avatar.go Fix frontpage avatars (#13853) 4 years ago
avatar_test.go Direct avatar rendering (#13649) 4 years ago
branches.go Code Formats, Nits & Unused Func/Var deletions (#15286) 3 years ago
branches_test.go Add deleted_branch table fixture (#2832) 7 years ago
commit_status.go chore(models): rewrite code format. (#14754) 3 years ago
commit_status_test.go Fix bug about ListOptions and stars/watchers pagnation (#14556) 3 years ago
consistency.go Fix Migration 176 yet again (#15131) 3 years ago
context.go Upgrade xorm to v1.0.2 (#11900) 4 years ago
convert.go Whilst changing the character set to utf8mb4 we should set ROW_FORMAT=dynamic too (#12804) 4 years ago
error.go rsponse 404 when delete not exist email (#15383) 3 years ago
error_oauth2.go gofmt (#1662) 7 years ago
external_login_user.go chore(models): rewrite code format. (#14754) 3 years ago
fixture_generation.go chore(models): rewrite code format. (#14754) 3 years ago
fixture_test.go Move fixture generation to contrib and add test (#10277) 4 years ago
gpg_key.go chore(models): rewrite code format. (#14754) 3 years ago
gpg_key_test.go chore(models): rewrite code format. (#14754) 3 years ago
helper.go chore(models): rewrite code format. (#14754) 3 years ago
helper_directory.go Re-attempt to delete temporary upload if the file is locked by another process (#12447) 4 years ago
helper_environment.go chore(models): rewrite code format. (#14754) 3 years ago
issue.go chore(models): rewrite code format. (#14754) 3 years ago
issue_assignees.go chore(models): rewrite code format. (#14754) 3 years ago
issue_assignees_test.go Fix API Bug (fail on empty assignees) (#8873) 5 years ago
issue_comment.go chore(models): rewrite code format. (#14754) 3 years ago
issue_comment_list.go chore(models): rewrite code format. (#14754) 3 years ago
issue_comment_test.go Pull request review/approval and comment on code (#3748) 6 years ago
issue_dependency.go chore(models): rewrite code format. (#14754) 3 years ago
issue_dependency_test.go Refactor comment (#9330) 5 years ago
issue_label.go Code Formats, Nits & Unused Func/Var deletions (#15286) 3 years ago
issue_label_test.go chore(models): rewrite code format. (#14754) 3 years ago
issue_list.go chore(models): rewrite code format. (#14754) 3 years ago
issue_list_test.go Add Organization Wide Labels (#10814) 4 years ago
issue_lock.go chore(models): rewrite code format. (#14754) 3 years ago
issue_milestone.go Add dashboard milestone search and repo milestone search by name (#14866) 3 years ago
issue_milestone_test.go Add name filter to API for GetMilestoneList (#12336) 4 years ago
issue_reaction.go chore(models): rewrite code format. (#14754) 3 years ago
issue_reaction_test.go Migrate reactions when migrating repository from github (#9599) 5 years ago
issue_stopwatch.go chore(models): rewrite code format. (#14754) 3 years ago
issue_stopwatch_test.go Add gitea-vet (#10948) 4 years ago
issue_test.go chore(models): rewrite code format. (#14754) 3 years ago
issue_tracked_time.go chore(models): rewrite code format. (#14754) 3 years ago
issue_tracked_time_test.go chore(models): rewrite code format. (#14754) 3 years ago
issue_user.go Mail assignee when issue/pull request is assigned (#8546) 5 years ago
issue_user_test.go Add "Update Branch" button to Pull Requests (#9784) 5 years ago
issue_watch.go chore(models): rewrite code format. (#14754) 3 years ago
issue_watch_test.go API add/generalize pagination (#9452) 4 years ago
issue_xref.go chore(models): rewrite code format. (#14754) 3 years ago
issue_xref_test.go Refactor comment (#9330) 5 years ago
lfs.go Code Formats, Nits & Unused Func/Var deletions (#15286) 3 years ago
lfs_lock.go chore(models): rewrite code format. (#14754) 3 years ago
list_options.go Fix bug about ListOptions and stars/watchers pagnation (#14556) 3 years ago
log.go Fix xorm log stack level (#15285) 3 years ago
login_source.go chore(models): rewrite code format. (#14754) 3 years ago
main_test.go Add gitea-vet (#10948) 4 years ago
migrate.go Fix delete nonexist oauth application 500 and prevent deadlock (#15384) 3 years ago
models.go Create Proper Migration Tests (#15116) 3 years ago
models_test.go gitea dump: include version & Check InstallLock (#12760) 4 years ago
notification.go chore(models): rewrite code format. (#14754) 3 years ago
notification_test.go add request review from specific reviewers feature in pull request (#10756) 4 years ago
oauth2.go chore(models): rewrite code format. (#14754) 3 years ago
oauth2_application.go Fix delete nonexist oauth application 500 and prevent deadlock (#15384) 3 years ago
oauth2_application_test.go Minimal OpenID Connect implementation (#14139) 4 years ago
org.go chore(models): rewrite code format. (#14754) 3 years ago
org_team.go chore(models): rewrite code format. (#14754) 3 years ago
org_team_test.go chore(models): rewrite code format. (#14754) 3 years ago
org_test.go chore(models): rewrite code format. (#14754) 3 years ago
project.go chore(models): rewrite code format. (#14754) 3 years ago
project_board.go chore(models): rewrite code format. (#14754) 3 years ago
project_issue.go chore(models): rewrite code format. (#14754) 3 years ago
project_test.go chore(models): rewrite code format. (#14754) 3 years ago
pull.go Always set the merge base used to merge the commit (#15352) 3 years ago
pull_list.go API add/generalize pagination (#9452) 4 years ago
pull_sign.go Add configurable Trust Models (#11712) 4 years ago
pull_test.go Display pull request head branch even the branch deleted or repository deleted (#10413) 4 years ago
release.go Implement delete release attachments and update release attachments' name (#14130) 3 years ago
repo.go Add LFS Migration and Mirror (#14726) 3 years ago
repo_activity.go Add top author stats to activity page (#9615) 4 years ago
repo_avatar.go Avatars and Repo avatars support storing in minio (#12516) 4 years ago
repo_branch.go Move newbranch to standalone package (#9627) 5 years ago
repo_collaboration.go Save TimeStamps for Star, Label, Follow, Watch and Collaboration to Database (#13124) 4 years ago
repo_collaboration_test.go API add/generalize pagination (#9452) 4 years ago
repo_generate.go Fix broken migration on webhook (#13911) 4 years ago
repo_generate_test.go Variable expansion in repository templates (#9163) 5 years ago
repo_indexer.go Index code and stats only for non-empty repositories (#10251) 4 years ago
repo_issue.go Add EnableTimetracking option to app settings (#3719) 6 years ago
repo_language_stats.go chore(models): rewrite code format. (#14754) 3 years ago
repo_list.go Improve /api/v1/repos/issues/search by just getting repo ids (#15179) 3 years ago
repo_list_test.go chore(models): rewrite code format. (#14754) 3 years ago
repo_mirror.go Add LFS Migration and Mirror (#14726) 3 years ago
repo_permission.go ui: show 'owner' tag for real owner (#13689) 4 years ago
repo_permission_test.go fix bug when update owner team then visit team's repo return 404 (#6119) 5 years ago
repo_redirect.go Redirect on changed user and org name (#11649) 3 years ago
repo_redirect_test.go Redirect on changed user and org name (#11649) 3 years ago
repo_sign.go Add configurable Trust Models (#11712) 4 years ago
repo_test.go Code Formats, Nits & Unused Func/Var deletions (#15286) 3 years ago
repo_transfer.go Fix Migration 176 yet again (#15131) 3 years ago
repo_transfer_test.go chore(models): rewrite code format. (#14754) 3 years ago
repo_unit.go Add DefaultMergeStyle option to repository (#14789) 3 years ago
repo_watch.go chore(models): rewrite code format. (#14754) 3 years ago
repo_watch_test.go API add/generalize pagination (#9452) 4 years ago
review.go chore(models): rewrite code format. (#14754) 3 years ago
review_test.go chore(models): rewrite code format. (#14754) 3 years ago
session.go Create DB session provider(based on xorm) (#13031) 3 years ago
sql_postgres_with_schema.go Ensure that schema search path is set with every connection on postgres (#14131) 4 years ago
ssh_key.go chore(models): rewrite code format. (#14754) 3 years ago
ssh_key_test.go Add support for ed25519_sk and ecdsa_sk SSH keys (#13462) 3 years ago
star.go Save TimeStamps for Star, Label, Follow, Watch and Collaboration to Database (#13124) 4 years ago
star_test.go API add/generalize pagination (#9452) 4 years ago
task.go chore(models): rewrite code format. (#14754) 3 years ago
test_fixtures.go Create Proper Migration Tests (#15116) 3 years ago
token.go [API] Delete Token accept names too (#12366) 4 years ago
token_test.go chore(models): rewrite code format. (#14754) 3 years ago
topic.go chore(models): rewrite code format. (#14754) 3 years ago
topic_test.go API add/generalize pagination (#9452) 4 years ago
twofactor.go Attachments: Add extension support, allow all types for releases (#12465) 4 years ago
u2f.go Display ui time with customize time location (#7792) 5 years ago
u2f_test.go Add gitea-vet (#10948) 4 years ago
unit.go Kanban board (#8346) 4 years ago
unit_tests.go chore(models): rewrite code format. (#14754) 3 years ago
update.go Remove Unused Functions (#10516) 4 years ago
upload.go Handle and propagate errors when checking if paths are Dirs, Files or Exist (#13186) 4 years ago
user.go Fix `admin user list` (#15358) 3 years ago
user_avatar.go Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL (#12999) 3 years ago
user_follow.go Save TimeStamps for Star, Label, Follow, Watch and Collaboration to Database (#13124) 4 years ago
user_follow_test.go Add gitea-vet (#10948) 4 years ago
user_heatmap.go Code Formats, Nits & Unused Func/Var deletions (#15286) 3 years ago
user_heatmap_test.go chore(models): rewrite code format. (#14754) 3 years ago
user_mail.go rsponse 404 when delete not exist email (#15383) 3 years ago
user_mail_test.go Admin page for managing user e-mail activation (#10557) 4 years ago
user_openid.go Code Formats, Nits & Unused Func/Var deletions (#15286) 3 years ago
user_openid_test.go Add golangci (#6418) 5 years ago
user_redirect.go Redirect on changed user and org name (#11649) 3 years ago
user_redirect_test.go Redirect on changed user and org name (#11649) 3 years ago
user_test.go chore(models): rewrite code format. (#14754) 3 years ago
userlist.go chore(models): rewrite code format. (#14754) 3 years ago
userlist_test.go chore(models): rewrite code format. (#14754) 3 years ago
webhook.go chore(models): rewrite code format. (#14754) 3 years ago
webhook_test.go chore(models): rewrite code format. (#14754) 3 years ago
wiki.go Handle and propagate errors when checking if paths are Dirs, Files or Exist (#13186) 4 years ago
wiki_test.go Move wiki related funtions from models to services/wiki (#9355) 5 years ago