Commit Graph

36 Commits (d9ecdcaef02346ac1980b359ed006a4f2a51349f)

Author SHA1 Message Date
Joe Chen d9ecdcaef0
all: unwrap `database.UsersStore` interface (#7708) 2024-03-27 23:18:59 -04:00
Joe Chen 202012887a
all: unwrap `database.TwoFactorsStore` interface (#7707) 2024-03-27 22:14:08 -04:00
Joe Chen 8054ffc12f
all: unwrap `database.AccessTokensStore` interface (#7670) 2024-02-20 21:47:32 -05:00
Joe Chen 3650b32ec5
chore: rename `internal/db` to `internal/database` (#7665) 2024-02-18 19:39:41 -05:00
Joe Chen 0721ef2399
refactor(db): migrate off `user_email.go` to `users.go` (#7452) 2023-05-14 20:15:47 -04:00
Joe Chen 133b9d9044
refactor(db): finish migrate methods off `user.go` (#7337) 2023-02-07 23:39:00 +08:00
Joe Chen c53a1998c5
all: replace `interface{}` with `any` (#7330)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2023-02-02 21:25:25 +08:00
Joe Chen ae20d03aec
refactor(db): migrate `UpdateUser` off `user.go` (#7267) 2022-11-27 19:36:10 +08:00
Joe Chen 13099a7e4f
refactor(db): add `Users.Update` (#7263) 2022-11-27 15:19:44 +08:00
Joe Chen 644a3a9d78
refactor(db): migrate `ChangeUsername` off `user.go` (#7261) 2022-11-25 22:40:20 +08:00
Joe Chen 5fb29db2db
refactor(db): migrate methods off and delete deprecated methods from `user.go` (#7231) 2022-11-05 23:33:05 +08:00
Joe Chen fd798b4197
refactor(db): migrate methods off `user.go` (#7228) 2022-11-05 17:55:05 +08:00
Joe Chen 3265abfbc2
refactor(db): migrate perms methods off `user.go` (#7207) 2022-10-23 21:22:36 +08:00
Joe Chen d0a4a3401c
refactor(db): migrate avatar methods off `user.go` (#7206) 2022-10-23 20:54:16 +08:00
Joe Chen c58c893621
refactor(db): migrate password methods off `user.go` (#7205) 2022-10-23 19:15:14 +08:00
Joe Chen 11edc09681
refactor: replace `ioutil.ReadAll` with `io.ReadAll` (#7200) 2022-10-22 21:34:53 +08:00
Joe Chen ce25881c88
refactor(db): move some methods off `user.go` (#7199) 2022-10-22 20:01:38 +08:00
Joe Chen 7cbd84d5b3
refactor(db): rename `User.Passwd` to `User.Password` (#7196) 2022-10-22 14:56:25 +08:00
Joe Chen 5e32058c13
db: use `context` and go-mockgen for `TwoFactorsStore` (#7045) 2022-06-11 11:54:11 +08:00
Joe Chen f837ea6346
db: use `context` and go-mockgen for `UsersStore` (#7042) 2022-06-11 09:42:17 +08:00
Joe Chen 0a92ad27ef
db: use `context` and go-mockgen for `AccessTokensStore` (#7013) 2022-06-06 12:10:36 +08:00
ᴜɴᴋɴᴡᴏɴ 3af91d7cfd
auth: decouple types and functions from db (#6320) 2020-09-20 11:19:02 +08:00
ᴜɴᴋɴᴡᴏɴ 9d64d222a8
db: add tests for users (#6116)
* Add new methods

* Use Users.Create to replace previous hack

* Reduce side effect

* Do not clear tables when test failed

* test_users_Authenticate

* Rename constant

* test_users_Create

* test_users_GetByEmail

* test_users_GetByID

* test_users_GetByUsername
2020-04-18 12:07:30 +08:00
ᴜɴᴋɴᴡᴏɴ fa497b1633
db: add tests for repos (#6112)
* Add Repos.create method

* Fix repo name error handling

* Fix all compile errors

* Update github.com/go-macaron/captcha to fix http issue

* Add repos tests
2020-04-17 10:14:18 +08:00
ᴜɴᴋɴᴡᴏɴ cb439a126a
db: add tests for two factors (#6099)
* Rename to TwoFactors.Create

* Use GORM to execute queries

* TwoFactor.GetByUserID

* Add tests

* Fix failing tests

* Add MD5 tests

* Add tests for RandomChars
2020-04-14 09:41:54 +08:00
ᴜɴᴋɴᴡᴏɴ 62dda96159
access_token: migrate to GORM and add tests (#6086)
* access_token: migrate to GORM

* Add tests

* Fix tests

* Fix test clock
2020-04-11 01:25:19 +08:00
ᴜɴᴋɴᴡᴏɴ 34145c990d
lfs: implement HTTP routes (#6035)
* Bootstrap with GORM

* Fix lint error

* Set conn max lifetime to one minute

* Fallback to use gorm v1

* Define HTTP routes

* Finish authentication

* Save token updated

* Add docstring

* Finish authorization

* serveBatch rundown

* Define types in lfsutil

* Finish Batch

* authutil

* Finish basic

* Formalize response error

* Fix lint errors

* authutil: add tests

* dbutil: add tests

* lfsutil: add tests

* strutil: add tests

* Formalize 401 response
2020-04-04 21:14:15 +08:00
ᴜɴᴋɴᴡᴏɴ 5843038a08
workflows: enable golangci-lint (#5998)
* Create golint.yml

* Update golint.yml

* Update golint.yml

* Fix errcheck

* Fix gosimple

* Fix staticcheck
2020-03-21 13:39:32 +08:00
ᴜɴᴋɴᴡᴏɴ 9e9ca66467
refactor: unify error handling in routing layer 2020-03-16 01:22:27 +08:00
ᴜɴᴋɴᴡᴏɴ 82ff0c5852
email: check the owner when set as primary (#5988)
* email: check the owner when set as primary

Fixes a security issue reported by muxishuihan.

* Update CHANGELOG
2020-03-15 18:58:56 +08:00
ᴜɴᴋɴᴡᴏɴ 7950f2d17d
conf: overhaul auth and user settings (#5942)
* conf: overhaul auth and user settings

* ci: update travis Go versions
2020-02-27 18:06:38 +08:00
ᴜɴᴋɴᴡᴏɴ 52ffb67b33
conf: overhaul email settings (#5940) 2020-02-25 00:35:35 +08:00
ᴜɴᴋɴᴡᴏɴ 648d9e253c
conf: overhaul server settings (#5928)
* conf: rename package

* Requires Go 1.12

* Fix lint

* Fix lint

* Overhaul

* db: fix tests

* Save my work

* Fix tests

* Server.UnixSocketPermission

* Server.LocalRootURL

* SSH settings

* Server.OfflineMode

* Save my work

* App.Version

* Remove [server] STATIC_ROOT_PATH

* Server.LandingURL
2020-02-22 09:05:26 +08:00
ᴜɴᴋɴᴡᴏɴ 1c09373b4f
log: migrate to unknwon.dev/clog/v2 (#5927)
* Add unknwon.dev/clog/v2

* Update all places
2020-02-20 02:25:02 +08:00
Achilleas Koutsou 873966aa86 user/setting: check for IsErrEmailAlreadyUsed when updating user (#5900)
Check for email collisions when updating the entire user information,
not when the username is being changed.

Fixes #5899
2020-01-23 02:05:31 +08:00
Unknwon 01c8df01ec
internal: move packages under this directory (#5836)
* Rename pkg -> internal

* Rename routes -> route

* Move route -> internal/route

* Rename models -> db

* Move db -> internal/db

* Fix route2 -> route

* Move cmd -> internal/cmd

* Bump version
2019-10-24 01:51:46 -07:00