2
0
Commit Graph

546 Commits

Author SHA1 Message Date
Morgan Bazalgette
e45a300221 General refactor of the cmd package (#3328)
* General refactor of the cmd package

* Address breakage in runCreateUser

* Place "common" functions into cmd.go
2018-01-12 23:16:49 +01:00
Kim "BKC" Carlbäcker
54f635c8f5 Cleanup models.User.HashPassword (#3334) 2018-01-12 00:19:38 +02:00
Morgan Bazalgette
8365098892 Change EncodePasswd to HashPassword (#3329)
* Change EncodePasswd to HashPassword

* Create test+benchmark for HashPassword
2018-01-08 23:28:18 +01:00
Sandro Santilli
4baaebe474 Add repo-sync-releases admin command (#3254)
* Add repo-sync-releases admin command

Will help recovering corrupted database, see #3247

* Load repos in chunks of 10, exit with error if unable to get a list, scan private repos, fix typo

* Fix debug output about num releases

* Introduce RepositoryListDefaultPageSize constant, set to 64

Use it from the new admin command

* Use RepositoryListDefaultPageSize in more places

* Document RepositoryListDefaultPageSize
2017-12-31 16:45:46 +02:00
Mike Fellows
10529bd508 Add an option to allow redirect of http port 80 to https. (#1928)
* Add an option to allow redirect of http port 80 to https.

This is an "opt in" option (default is to not redirect).  It will only redirect
if protocol is https and the new REDIRECT_PORT_80 option is set to true.

The Port to redirect in previous commit was hardcoded to 80, now it can be
specified in the app.ini, defaulting to 80.  The boolean option to turn
redirection on has been changed to REDIRECT_OTHER_PORT to be logically
consistent with the new port option.

Signed-off-by: Mike Fellows <mike.fellows@shaw.ca>
2017-12-25 23:23:43 +01:00
Lunny Xiao
e9f4ff0997 Improvements for supporting UI Location (#3146)
* improvements for supporting UI Location

* improved the comment
2017-12-14 07:45:31 +08:00
Lunny Xiao
85a94b9ea5 fix run web with -p push failed (#3154) 2017-12-13 16:57:28 +08:00
Lunny Xiao
a15d8c22e1 Remove GetRepositoryByRef and add GetRepositoryByOwnerAndName (#3043)
* remove GetRepositoryByRef and add GetRepositoryByOwnerAndName

* fix tests

* fix tests bug

* some improvements
2017-12-02 15:34:39 +08:00
Lunny Xiao
24158809c1 Add external markup render support (#2570)
* add external markup render support

* bug fixed

* refacotr codes and fix wrong error log

* fix comments and add check to prevent leaks

* add check for config file and improve the example

* check file close error

* use ioutil.TempFile instead uuid

* correct Render -> Parser

* improve warning when incorrect markup setting

* fix typos
2017-11-07 08:33:06 +02:00
Guillaume Dube
05fa8a5c8e Set session and indexers' data files rel to AppDataPath (#2192)
* Set session and indexers' data files rel to AppDataPath

The setting AppDataPath is now relative to the working directory.
The session svc's PROVIDER_CONFIG now defaults to AppDataPath/data/sessions.
The issue indexer's IssuePath now defaults to AppDataPath/indexers/issues.bleves.

* fix bug
2017-11-03 10:56:20 +02:00
Lunny Xiao
7bddb36f89 improve force push detect when push (#2798) 2017-10-28 22:36:20 +03:00
Lunny Xiao
0aaf1e7c47 improve protected branch to add whitelist support (#2451)
* improve protected branch to add whitelist support

* fix lint

* fix style check

* fix tests

* fix description on UI and import

* fix test

* bug fixed

* fix tests and languages

* move isSliceInt64Eq to util pkg; improve function names & typo
2017-09-14 16:16:22 +08:00
Lunny Xiao
8503e52685 Only update needed columns when update user (#2296)
* only update needed columns when update user

* fix missing update_unix column
2017-08-12 22:18:44 +08:00
Jonas Östanbäck
8d080c45ef Set TMPDIR enviroment variable for dump command (#1915) 2017-06-08 19:24:15 -05:00
Bo-Yi Wu
4725f81411 feat: add check misspelling (#1877) 2017-06-05 02:49:46 -05:00
Lunny Xiao
90331a5642 fix admin lost permission caused by #947 2017-05-19 08:59:26 +08:00
Lunny Xiao
d9d2f96121 Add units to team (#947)
* add units to team

* fix lint

* finish team setting backend

* finished permission controll on routes

* fix import blank line

* add unit check on ssh/http pull and push and fix test failed

* fix fixtures data

* remove unused code
2017-05-18 22:54:24 +08:00
Lunny Xiao
2db89f5531 Remove env user salt since no need to use (#1515)
* remove env user salt since no need to use

* remove unused variable from update.go
2017-05-06 21:21:22 +08:00
Lunny Xiao
b224ce0522 Drop db operations from hook commands (#1514)
* move all database operations from hook command to web command and instead of internal routes

* bug fixed

* adjust the import path sequences

* remove unused return value on hookSetup
2017-05-04 13:42:02 +08:00
Ethan Koenig
e109a87e4a Integration test framework (#1290)
* Integration test framework

* udpate drone sign

* Formatting fixes and move router.go to routers/

* update sign for drone
2017-04-25 15:24:51 +08:00
Lunny Xiao
1706bf29eb support health check via / and fix #969 (#1520) 2017-04-20 20:14:21 +08:00
Bo-Yi Wu
ba154469ab feat: add download count field and unit testing for attachment. (#1512)
* feat: add download count field and unit testing.

* fix: unit testing

* refactor: improve testing.

* fix: update comment

* add default value.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-04-20 10:31:31 +08:00
Lunny Xiao
19b28d7494 Add internal routes for ssh hook comands (#1471)
* add internal routes for ssh hook comands

* fix lint

* add comment on why package named private not internal but the route name is internal

* add comment above package private why package named private not internal but the route name is internal

* remove exp time on internal access

* move routes from /internal to /api/internal

* add comment and defer on UpdatePublicKeyUpdated
2017-04-19 11:45:01 +08:00
Lauris BH
54928cb15a Better URL validation (#1507)
* Add correct git branch name validation

* Change git refname validation error constant name

* Implement URL validation based on GoLang url.Parse method

* Backward compatibility with older Go compiler

* Add git reference name validation unit tests

* Remove unused variable in unit test

* Implement URL validation based on GoLang url.Parse method

* Backward compatibility with older Go compiler

* Add url validation unit tests
2017-04-19 11:02:20 +08:00
Bo-Yi Wu
275057e645 refactor: show command help message. (#1486) 2017-04-12 15:44:54 +08:00
Lunny Xiao
720edb0957 refactor update ssh key use time (#1466) 2017-04-07 17:40:38 -07:00
Andrey Nering
f92375602e Add watch button on issue 2017-03-29 20:31:47 -03:00
Sandro Santilli
3c702d13c5 Allow ENABLE_OPENID_SIGNUP to depend on DISABLE_REGISTRATION (#1369)
* Allow ENABLE_OPENID_SIGNUP to depend on DISABLE_REGISTRATION

Omit the configuration variable (the default) to be dependent.
Fixes #1363

* Move OpenID settings under Service object

* Show OpenID SignUp and SignIn status in admin panel / configuration
2017-03-29 18:57:43 +08:00
Pavel Korovin
23f22342c5 Fix FCGI (over TCP) support (#1368) 2017-03-23 15:57:43 +08:00
Fabian Zaremba
dee1698f2c LFS: Fix SSH authentication for trailing arguments (#1328)
Fixes #1296
2017-03-22 18:43:28 +08:00
Fabian Zaremba
bb2c6feded LFS: Return 404 for unimplemented endpoints (#1330)
Without this patch a 401 is returned for unspecified endpoints, making
the LFS client ask for HTTP credentials. This behaviour was introduced
with the new locking API:

https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md
2017-03-20 16:40:20 +08:00
Sandro Santilli
887d5a0e6b Show user OpenID URIs in their profile (#1314) 2017-03-20 09:31:08 +01:00
Sandro Santilli
d332310ee1 Add change-password admin command (#1304)
* Add change-password admin command
2017-03-20 09:23:38 +01:00
Bo-Yi Wu
2c2c55b683 feat: Only use issue and wiki on repo. (#1297) 2017-03-18 18:59:07 +08:00
Sandro Santilli
aa764ab02b Login via OpenID-2.0 (#618) 2017-03-17 15:16:08 +01:00
Lunny Xiao
8f951e0385 Allow push to init a wiki repo (#1279)
* allow push to init a wiki repo

* compact error check
2017-03-17 12:59:42 +08:00
Ethan Koenig
e1e7091261 Batch updates for issues (#926) 2017-03-15 02:10:35 +01:00
Ethan Koenig
48b4de20eb Refactor and fix incorrect comment (#1247) 2017-03-15 08:51:46 +08:00
Sandro Santilli
0b4f73cbdf Rename /forget_password url to /forgot_password
Also renames `forgot_password` translation key to
`forgot_password_title` and `forget_password` to
`forgot_password`

Includes entry in CHANGELOG about the breaking change
(and some markdown fixes in there)
2017-03-14 22:54:07 +01:00
Lunny Xiao
8242994ab7 bug fix for dump when data directoryis not exist (#1025) 2017-03-02 17:41:33 +08:00
Lunny Xiao
16e81e9013 Comment force push detect to fix bug #1073 (#1077)
* umcomment force push detect to fix bug #1073

* fix #1086

* handle global config set and fix #1086
2017-03-01 23:01:03 +08:00
Lunny Xiao
f67125b55d fix push (#1076) 2017-02-27 14:24:58 +08:00
Lunny Xiao
00605a7489 remove unused struct (#1062) 2017-02-27 09:49:05 +08:00
Lunny Xiao
e521de1bec remove unused fixme on dump command (#1065) 2017-02-26 16:01:49 +08:00
Lunny Xiao
b4bec9c7f9 Move push update to post-receive and protected branch check to pre-receive (#1030)
* move all push update to git hook post-receive and protected branch check to git hook pre-receive

* add SSH_ORIGINAL_COMMAND check back

* remove all unused codes

* fix the import
2017-02-25 22:54:40 +08:00
Lunny Xiao
fbbc585cea Take back control of hooks (#1006)
* git: delegate all server-side Git hooks (#1623)

* create hooks directories

* take control hooks back

* fix lint

* bug fixed and minor changes

* fix imports style

* fix migration scripts
2017-02-23 11:40:44 +08:00
Willem van Dreumel
64016ca7ac Oauth2 consumer (#679)
* initial stuff for oauth2 login, fails on:
* login button on the signIn page to start the OAuth2 flow and a callback for each provider
Only GitHub is implemented for now
* show login button only when the OAuth2 consumer is configured (and activated)
* create macaron group for oauth2 urls
* prevent net/http in modules (other then oauth2)
* use a new data sessions oauth2 folder for storing the oauth2 session data
* add missing 2FA when this is enabled on the user
* add password option for OAuth2 user , for use with git over http and login to the GUI
* add tip for registering a GitHub OAuth application
* at startup of Gitea register all configured providers and also on adding/deleting of new providers
* custom handling of errors in oauth2 request init + show better tip
* add ExternalLoginUser model and migration script to add it to database
* link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed
* remove the linked external account from the user his settings
* if user is unknown we allow him to register a new account or link it to some existing account
* sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers)

* from gorilla/sessions docs:
"Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!"
(we're using gorilla/sessions for storing oauth2 sessions)

* use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
2017-02-22 08:14:37 +01:00
Denis Denisov
e6d86ee29c Protected branches system (#339)
* Protected branches system

* Moved default branch to branches section (`:org/:reponame/settings/branches`).
* Initial support Protected Branch.
  - Admin does not restrict
  - Owner not to limit
  - To write permission restrictions

* reformat tmpl

* finished the UI and add/delete protected branch response

* remove unused comment

* indent all the template files and remove ru translations since we use crowdin

* fix the push bug
2017-02-21 23:02:10 +08:00
Christoph König
b9b8e83758 Fix typo (#990) 2017-02-21 09:14:37 +08:00
Lunny Xiao
531ade9165 Make Xorm log configurable (#174)
* make xorm log configable

* bug fixed for other sub commands except web

* rebase and fix xorm log

* bug fix for TrimSpace
2017-02-20 16:11:13 +08:00