summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* API: fix set milestone on PR creation (#14981) (#15001)Norwin2021-03-151-3/+1
| | | | | | | | | | | | * API: fix set milestone on PR creation pr creation via API failed with 404, because we searched for milestoneID 0, due to uninitialized var usage D: * add tests Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@obermui.de>
* Prevent panic when editing forked repos by API (#14960) (#14963)65432021-03-121-0/+4
| | | | | | | | | | When editing forked repos using the API the BaseRepository needs to loaded in order to check its visibility otherwise there will be NPE panic. Fix #14956 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Print usefull error if SQLite is used in settings but not supported (#14476) ↵65432021-03-031-4/+7
| | | | | | | | (#14874) * move log output to points where they are relefant * check explicit of sqlite3 in settings
* Set HCaptchaSiteKey on Link Account pages (#14834) (#14839)zeripath2021-03-011-0/+3
| | | | | | | | | | Backport #14834 When using HCaptcha on link account pages the site key needs to be passed in. This PR ensures that HCaptchaSiteKey is set in the data. Fix #14766 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Backport: Repo Transfer permission checks (#14792) (#14794)65432021-02-252-2/+10
| | | | | * Backport: Repo Transfer permission checks (#14792) * update tests
* Allow org labels to be set with issue templates (#14593) (#14647)zeripath2021-02-131-1/+8
| | | | | | | | | Backport #14593 Fix #13688 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix bug about ListOptions and stars/watchers pagnation (#14556) (#14573)65432021-02-051-1/+5
| | | | | | * Fix bug about ListOptions and stars/watchers pagnation * fix unit test
* Fix lfs preview bug (#14428) (#14433)65432021-01-231-1/+4
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Use path not filepath in routers/editor (#14390) (#14396)65432021-01-191-4/+3
| | | | | | | | | The incorrect use of filepath instead of path means that it is possible to cause a stackoverflow on Windows Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Use Request.URL.RequestURI() for fcgi (#14312) (#14347)Kyungmin Bae2021-01-151-4/+4
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Use ServerError provided by Context (#14333) (#14345)Lunny Xiao2021-01-153-5/+5
| | | ... instead of InternalServerError by macaron
* Add secure/httpOnly attributes to the lang cookie (#14279) (#14280)65432021-01-072-14/+18
| | | | | | | * Add secure/httpOnly attributes to the lang cookie (#9690) (#14279) * apply to InitLocales() too Co-authored-by: Timo Gurr <timo.gurr@gmail.com>
* Fix dashboard issues labels filter bug (#14210) (#14214)Lunny Xiao2021-01-021-0/+4
|
* Check for notExist on profile repository page (#14197) (#14203)zeripath2020-12-311-0/+3
| | | | | Backport #14197 Fix #14189
* Fix creation OAuth2 auth source from CLI. (#14146)Daniil Pankratov2020-12-251-2/+11
| | | Fix #8356
* Ensure that search term and page are not lost on adoption page-turn (#14133) ↵zeripath2020-12-241-1/+10
| | | | | | | | | (#14143) Backport #14133 Fix #14111 Signed-off-by: Andrew Thornton <art27@cantab.net>
* [API] GetCombinedCommitStatusByRef always return json & swagger doc fixes ↵65432020-12-182-3/+10
| | | | | | | (#14047) * Fix swagger docs * always return json
* HotFix: Hide private partisipation in Orgs (#13994) (#14031)65432020-12-172-11/+39
| | | | | * HotFix: Hide private partisipation in Orgs Co-authored-by: zeripath <art27@cantab.net>
* Ensure template renderer is available before storage handler (#13982)zeripath2020-12-141-1/+2
| | | | | | | | | | | `ctx.Error` requires that templates are available for this to render the error page otherwise there will be a panic at this time. This was fixed in #13164 but was not completely backported. Fix #13971 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Whenever the password is updated ensure that the hash algorithm is too ↵zeripath2020-12-132-3/+3
| | | | | | | | | | | | | | | (#13966) (#13967) Backport #13966 `user.HashPassword` may potentially - and in fact now likely does - change the `passwd_hash_algo` therefore whenever the `passwd` is updated, this also needs to be updated. Fix #13832 Thanks @fblaese for the hint Signed-off-by: Andrew Thornton <art27@cantab.net>
* log error when login failed (#13903) (#13913)Lunny Xiao2020-12-091-4/+4
| | | | | | Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: 6543 <6543@obermui.de>
* Add Allow-/Block-List for Migrate & Mirrors (#13610) (#13776)65432020-12-012-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add black list and white list support for migrating repositories * specify log message * use blocklist/allowlist * allways use lowercase to match url * Apply allow/block * Settings: use existing "migrations" section * convert domains lower case * dont store unused value * Block private addresses for migration by default * use proposed-upstream func to detect private IP addr * add own error for blocked migration, add tests, imprufe api * fix test * fix-if-localhost-is-ipv4 * rename error & error message * rename setting options * Apply suggestions from code review Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Set RUN_MODE prod by default (#13765) (#13767)silverwind2020-12-011-3/+5
| | | | | | | | | | | | | * Set RUN_MODE prod by default (#13765) I think it's a bad default to have "dev" as the default run mode which enables debugging and now also disables HTTP caching. It's better to just default to a value suitable for general deployments. Co-authored-by: techknowlogick <techknowlogick@gitea.io> * flip default in checkRunMode Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* ui: show 'owner' tag for real owner (#13689) (#13743)a10121127962020-11-291-2/+21
| | | | | | | | | | | | | | | | | | * ui: show 'owner' tag for real owner Signed-off-by: a1012112796 <1012112796@qq.com> * Update custom/conf/app.example.ini * simplify logic fix logic fix a small bug about original author * remove system manager tag Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* Validate email before inserting/updating (#13475) (#13666)65432020-11-226-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add email validity check (#13475) * Improve error feedback for duplicate deploy keys Instead of a generic HTTP 500 error page, a flash message is rendered with the deploy key page template so inform the user that a key with the intended title already exists. * API returns 422 error when key with name exists * Add email validity checking Add email validity checking for the following routes: [Web interface] 1. User registration 2. User creation by admin 3. Adding an email through user settings [API] 1. POST /admin/users 2. PATCH /admin/users/:username 3. POST /user/emails * Add further tests * Add signup email tests * Add email validity check for linking existing account * Address PR comments * Remove unneeded DB session * Move email check to updateUser Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> * skip email validation on empty string (#13627) - move validation into its own function - use a session for UpdateUserSetting * rm TODO for backport Co-authored-by: Chris Shyi <chrisshyi13@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix issue/pull request list assignee filter (#13647) (#13651)Karl Heinz Marbaise2020-11-191-0/+2
| | | | | | | | | | | | | | * Fixes #13641 - Filtering in Pull Request kept all the time. - The URL contains all the time the assignee in cases where once a type has been selected. Signed-off-by: Karl Heinz Marbaise <kama@soebes.de> * Followup Fixes #13641 - Filtering in Pull Request kept all the time. - The URL contains all the time the assignee in cases where once a type has been selected. - The same behaviour was observed issues viewed via milestones. Signed-off-by: Karl Heinz Marbaise <kama@soebes.de>
* API: Fix GetQueryBeforeSince (#13561)65432020-11-195-23/+43
|
* Fix a bug when check if owner is active (#13613)Lunny Xiao2020-11-182-2/+2
|
* [API] Only Return Json (#13511) (#13565)65432020-11-152-46/+38
| | | | | Backport #13511 Co-authored-by: zeripath <art27@cantab.net>
* Prevent git operations for inactive users (#13527) (#13536)Lunny Xiao2020-11-132-10/+44
| | | | | | | | | | | | | * prevent git operations for inactive users * Some fixes * Deny push to the repositories which's owner is inactive * deny operations also when user is ProhibitLogin Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* And there is another one ... (#13350)zeripath2020-10-291-1/+5
| | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Remove obsolete change of email on profile page (#13341) (#13347)techknowlogick2020-10-291-1/+0
| | | | | | | | | | | | | | | * Remove obsolete change of email on profile page The change email on the account profile page is out-of-date and unnecessary. Changing email should be done using the account page. Fix #13336 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Migration failure during reaction migration from gitea (#13344) (#13345)techknowlogick2020-10-281-1/+1
| | | | | | | | | | | | | | | | * Migrating reactions is just not that important A failure during migrating reactions should not cause failure of migration. Signed-off-by: Andrew Thornton <art27@cantab.net> * When checking issue reactions check the correct permission Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
* Deny wrong pull (#13308) (#13326)M4RKUS-111112020-10-271-0/+6
| | | | | | | | | | | | | | | | | | * Deny wrong pull (#13308) * Deny wrong pull * Update routers/api/v1/repo/pull.go Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Markus <git+markus@obermui.de> Co-authored-by: zeripath <art27@cantab.net> * CI.restart() Co-authored-by: Markus <git+markus@obermui.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Avatar autogeneration fixed (#13282)Paweł Bogusławski2020-10-261-1/+5
| | | | | | | | This mod fixes problem with initial avatar autogeneration and avatar autogneration after deleting previous avatar. Related: https://github.com/go-gitea/gitea/issues/13159 Fixes: 80a6b0f5bce15a641fc75f5f1ef6e42ef54424bc Author-Change-Id: IB#1105243
* When the git ref is unable to be found return broken pr (#13218) (#13303)zeripath2020-10-251-1/+1
| | | | | | | Backport #13218 Fix #13216 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Store task errors following migrations and display them (#13246) (#13287)techknowlogick2020-10-243-18/+31
| | | | | | | | | | | | | | | | | | | | * Store task errors following migrations and display them When migrate tasks fail store the error in the task table and ensure that they show on the status page. Fix #13242 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update web_src/js/index.js * Hide the failed first Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
* Remove PAM from auth dropdown when unavailable (#13276) (#13281)John Olheiser2020-10-231-8/+15
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Return the full rejection message and errors in flash errors (#13221) (#13237)zeripath2020-10-215-17/+102
| | | | | | | | | | | | * Return the full rejection message and errors in flash errors (#13221) Signed-off-by: Andrew Thornton <art27@cantab.net> * Update routers/repo/pull.go Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* When handling errors in storageHandler check underlying error (#13178) (#13193)techknowlogick2020-10-181-2/+17
| | | | | | | | | Unfortunately there was a mistake in #13164 which fails to handle os.PathError wrapping an os.ErrNotExist Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
* Avatars and Repo avatars support storing in minio (#12516)Lunny Xiao2020-10-143-22/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Avatar support minio * Support repo avatar minio storage * Add missing migration * Fix bug * Fix test * Add test for minio store type on avatars and repo avatars; Add documents * Fix bug * Fix bug * Add back missed avatar link method * refactor codes * Simplify the codes * Code improvements * Fix lint * Fix test mysql * Fix test mysql * Fix test mysql * Fix settings * Fix test * fix test * Fix bug
* Show original author's reviews on pull summary box (#13127)赵智超2020-10-141-0/+7
| | | | | | | follow #12039, show original author's reviews by other way. fix #11705. Signed-off-by: a1012112796 <1012112796@qq.com>
* [Enhancement] Allow admin to merge pr with protected file changes (#12078)赵智超2020-10-136-158/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [Enhancement] Allow admin to merge pr with protected file changes As tilte, show protected message in diff page and merge box. Signed-off-by: a1012112796 <1012112796@qq.com> * remove unused ver * Update options/locale/locale_en-US.ini Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> * Add TrN * Apply suggestions from code review * fix lint * Update options/locale/locale_en-US.ini Co-authored-by: zeripath <art27@cantab.net> * Apply suggestions from code review * move pr proteced files check to TestPatch * Call TestPatch when protected branches settings changed * Apply review suggestion @CirnoT * move to service @lunny * slightly restructure routers/private/hook.go Adds a lot of comments and simplifies the logic Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * skip duplicate protected files check * fix check logic * slight refactor of TestPatch Signed-off-by: Andrew Thornton <art27@cantab.net> * When checking for protected files changes in TestPatch use the temporary repository Signed-off-by: Andrew Thornton <art27@cantab.net> * fix introduced issue with hook Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove the check on PR index being greater than 0 as it unnecessary Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Return 404 not 500 from API if team does not exist (#13118)zeripath2020-10-121-1/+1
| | | | | | | | | If team does not exist expect ErrTeamNotExist not ErrUserNotEXist Fix #11336 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add team support for review request (#12039)赵智超2020-10-121-48/+365
| | | | | | | | | | | Add team support for review request Block #11355 Signed-off-by: a1012112796 <1012112796@qq.com> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Improve error feedback for duplicate deploy keys (#13112)Chris Shyi2020-10-122-0/+5
| | | | | | Instead of a generic HTTP 500 error page, a flash message is rendered with the deploy key page template to inform the user that a key with the intended title already exists. Fixes #13110
* Update golangci-lint to version 1.31.0 (#13102)kolaente2020-10-117-12/+12
| | | | | | | This PR updates golangci-lint to the latest version 1.31.0. The upgrade introduced a new check for which I've fixed or disabled most cases. Signed-off-by: kolaente <k@knt.li>
* Add ssh certificate support (#12281)Wim2020-10-102-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add ssh certificate support * Add ssh certificate support to builtin ssh * Write trusted-user-ca-keys.pem based on configuration * Update app.example.ini * Update templates/user/settings/keys_principal.tmpl Co-authored-by: silverwind <me@silverwind.io> * Remove unused locale string * Update options/locale/locale_en-US.ini Co-authored-by: silverwind <me@silverwind.io> * Update options/locale/locale_en-US.ini Co-authored-by: silverwind <me@silverwind.io> * Update models/ssh_key.go Co-authored-by: silverwind <me@silverwind.io> * Add missing creation of SSH.Rootpath * Update cheatsheet, example and locale strings * Update models/ssh_key.go Co-authored-by: zeripath <art27@cantab.net> * Update models/ssh_key.go Co-authored-by: zeripath <art27@cantab.net> * Update models/ssh_key.go Co-authored-by: zeripath <art27@cantab.net> * Update models/ssh_key.go Co-authored-by: zeripath <art27@cantab.net> * Update models/ssh_key.go * Optimizations based on feedback * Validate CA keys for external sshd * Add filename option and change default filename Add a SSH_TRUSTED_USER_CA_KEYS_FILENAME option which default is RUN_USER/.ssh/gitea-trusted-user-ca-keys.pem Do not write a file when SSH_TRUSTED_USER_CA_KEYS is empty. Add some more documentation. * Remove unneeded principalkey functions * Add blank line * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * Add SSH_AUTHORIZED_PRINCIPALS_ALLOW option This adds a SSH_AUTHORIZED_PRINCIPALS_ALLOW which is default email,username this means that users only can add the principals that match their email or username. To allow anything the admin need to set the option anything. This allows for a safe default in gitea which protects against malicious users using other user's prinicipals. (before that user could set it). This commit also has some small other fixes from the last code review. * Rewrite principal keys file on user deletion * Use correct rewrite method * Set correct AuthorizedPrincipalsBackup default setting * Rewrite principalsfile when adding principals * Add update authorized_principals option to admin dashboard * Handle non-primary emails Signed-off-by: Andrew Thornton <art27@cantab.net> * Add the command actually to the dashboard template * Update models/ssh_key.go Co-authored-by: silverwind <me@silverwind.io> * By default do not show principal options unless there are CA keys set or they are explicitly set Signed-off-by: Andrew Thornton <art27@cantab.net> * allow settings when enabled * Fix typos in TrustedUserCAKeys path * Allow every CASignatureAlgorithms algorithm As this depends on the content of TrustedUserCAKeys we should allow all signature algorithms as admins can choose the specific algorithm on their signing CA * Update models/ssh_key.go Co-authored-by: Lauris BH <lauris@nix.lv> * Fix linting issue Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Change default log configuration (#13088)zeripath2020-10-101-1/+5
| | | | | | | | | | | | | | | * Change default log configuration This PR changes the install page and the docker default logging configuration to match the suggested configuration that I repeatedly end up suggesting on issues. It further improves the logging configuration docs to recommend specific instructions for how to configure logs for posting to issues. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update docs/content/doc/advanced/logging-documentation.en-us.md
* Disable DSA ssh keys by default (#13056)zeripath2020-10-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Disable DSA ssh keys by default OpenSSH has disabled DSA keys since version 7.0 As the docker runs openssh > v7.0 we should just disable DSA keys by default. Refers to #11417 Signed-off-by: Andrew Thornton <art27@cantab.net> * Just disable DSA keys by default Signed-off-by: Andrew Thornton <art27@cantab.net> * Appears we need to set the minimum key sizes too Signed-off-by: Andrew Thornton <art27@cantab.net> * Appears we need to set the minimum key sizes too Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove DSA type * Fix Tests Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv>