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

Reject duplicate AccessToken names #10994

Merged
merged 17 commits into from
Apr 13, 2020

Conversation

6543
Copy link
Member

@6543 6543 commented Apr 6, 2020

as title
source: #7135

@techknowlogick techknowlogick added the type/enhancement An improvement of existing functionality label Apr 6, 2020
@techknowlogick techknowlogick added this to the 1.12.0 milestone Apr 6, 2020
@6543
Copy link
Member Author

6543 commented Apr 6, 2020

Ready for Review

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 6, 2020
models/token.go Outdated Show resolved Hide resolved
@6543 6543 changed the title Reject duplicate applications name Reject duplicate AccessToken names Apr 6, 2020
@6543
Copy link
Member Author

6543 commented Apr 6, 2020

@lafriks done

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 6, 2020
@6543 6543 changed the title Reject duplicate AccessToken names [WIP] Reject duplicate AccessToken names Apr 7, 2020
@6543
Copy link
Member Author

6543 commented Apr 7, 2020

UPDATE: need some fixes for tests

@6543 6543 changed the title [WIP] Reject duplicate AccessToken names Reject duplicate AccessToken names Apr 7, 2020
@6543
Copy link
Member Author

6543 commented Apr 7, 2020

@lafriks hope you are fine with 50e8f92
since Tests dont runn in paralell there should be no race

@codecov-io
Copy link

codecov-io commented Apr 11, 2020

Codecov Report

Merging #10994 into master will increase coverage by 0.00%.
The diff coverage is 26.08%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10994   +/-   ##
=======================================
  Coverage   43.48%   43.49%           
=======================================
  Files         597      597           
  Lines       84706    84729   +23     
=======================================
+ Hits        36833    36851   +18     
- Misses      43332    43337    +5     
  Partials     4541     4541           
Impacted Files Coverage Δ
routers/user/setting/applications.go 41.17% <18.18%> (-4.44%) ⬇️
routers/api/v1/user/app.go 67.61% <20.00%> (-1.76%) ⬇️
models/token.go 74.60% <100.00%> (+0.83%) ⬆️
modules/process/manager.go 74.69% <0.00%> (-3.62%) ⬇️
modules/charset/charset.go 69.56% <0.00%> (-3.27%) ⬇️
modules/queue/unique_queue_disk_channel.go 53.84% <0.00%> (-1.93%) ⬇️
services/gitdiff/gitdiff.go 72.57% <0.00%> (-1.86%) ⬇️
services/pull/pull.go 32.66% <0.00%> (-0.20%) ⬇️
models/gpg_key.go 53.95% <0.00%> (+0.52%) ⬆️
modules/git/repo.go 48.11% <0.00%> (+0.83%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ac116c...c468f86. Read the comment docs.

@lafriks
Copy link
Member

lafriks commented Apr 13, 2020

Make lgtm work

@6543
Copy link
Member Author

6543 commented Apr 13, 2020

@lafriks sadly there is only one review :(

@lafriks
Copy link
Member

lafriks commented Apr 13, 2020

Yeah, only later noticed :)

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 13, 2020
@zeripath
Copy link
Contributor

Having thought long about this, I think it's probably reasonable to disallow duplicate names - because it could be confusing for users. Therefor LGTM.

@lafriks
Copy link
Member

lafriks commented Apr 13, 2020

make lgtm to me again ;)

@lafriks lafriks merged commit ad5c43a into go-gitea:master Apr 13, 2020
@lafriks lafriks deleted the reject_duplicate_applications_name branch April 13, 2020 19:02
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* make sure duplicate token names cannot be used

* add check to api routes too

* add @lunny s suggestion

* fix & don't forget User.ID

* AccessTokenByNameExists() return error too

* unique token for each test

* fix lint

Signed-off-by: 6543 <[email protected]>

Co-authored-by: Lanre Adelowo <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants