The Wayback Machine - https://web.archive.org/web/20220506183727/https://github.com/go-gitea/gitea/pull/13475
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

Add email validity check #13475

Merged
merged 18 commits into from Nov 14, 2020
Merged

Add email validity check #13475

merged 18 commits into from Nov 14, 2020

Conversation

Copy link
Contributor

@chrisshyi chrisshyi commented Nov 9, 2020

Added email validity checking for the following actions:

  • User update
  • User email addition
    • Through the web interface
    • Through the /user/emails endpoint
  • User creation:
    • Through the admin interface
    • Through the /admin/users endpoint

Chris Shyi and others added 10 commits Oct 12, 2020
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.
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
models/user.go Outdated Show resolved Hide resolved
options/locale/locale_zh-TW.ini Outdated Show resolved Hide resolved
@chrisshyi chrisshyi requested a review from lunny Nov 9, 2020
@chrisshyi chrisshyi changed the title Adding email validity check Add email validity check Nov 9, 2020
models/user.go Outdated Show resolved Hide resolved
Copy link
Member

@lafriks lafriks left a comment

Wrong button, see comment above

@chrisshyi chrisshyi requested a review from lafriks Nov 9, 2020
@lafriks lafriks added this to the 1.14.0 milestone Nov 9, 2020
models/user.go Show resolved Hide resolved
6543
6543 approved these changes Nov 11, 2020
@codecov-io
Copy link

@codecov-io codecov-io commented Nov 11, 2020

Codecov Report

Merging #13475 (f0df7e6) into master (7d2700c) will increase coverage by 0.06%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13475      +/-   ##
==========================================
+ Coverage   42.16%   42.22%   +0.06%     
==========================================
  Files         696      696              
  Lines       76480    76518      +38     
==========================================
+ Hits        32247    32311      +64     
+ Misses      38939    38911      -28     
- Partials     5294     5296       +2     
Impacted Files Coverage Δ
routers/api/v1/user/email.go 0.00% <0.00%> (ø)
routers/user/setting/account.go 25.51% <0.00%> (-0.54%) ⬇️
models/user_mail.go 50.38% <33.33%> (-0.41%) ⬇️
routers/admin/users.go 27.77% <50.00%> (+2.06%) ⬆️
routers/api/v1/admin/user.go 30.57% <50.00%> (+14.54%) ⬆️
routers/user/auth.go 12.19% <50.00%> (+0.53%) ⬆️
models/user.go 54.36% <75.00%> (+0.12%) ⬆️
models/error.go 36.75% <100.00%> (+1.52%) ⬆️
modules/queue/workerpool.go 57.95% <0.00%> (-0.82%) ⬇️
models/gpg_key.go 53.33% <0.00%> (-0.58%) ⬇️
... and 11 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 7d2700c...f0df7e6. Read the comment docs.

Copy link
Member

@techknowlogick techknowlogick left a comment

Thanks :)

@techknowlogick
Copy link

@techknowlogick techknowlogick commented Nov 14, 2020

@lunny please review

@techknowlogick techknowlogick merged commit d025d84 into go-gitea:master Nov 14, 2020
2 checks passed
6543 pushed a commit to 6543-forks/gitea that referenced this issue Nov 21, 2020
* 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 <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
@6543
Copy link

@6543 6543 commented Nov 21, 2020

-> #13666

techknowlogick added a commit that referenced this issue Nov 22, 2020
* 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 <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: techknowlogick <[email protected]>

* 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 <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

8 participants