Skip to content

Validate email before inserting/updating (#13475)#13666

Merged
techknowlogick merged 4 commits into
go-gitea:release/v1.13from
6543-forks:backport_mail-validation
Nov 22, 2020
Merged

Validate email before inserting/updating (#13475)#13666
techknowlogick merged 4 commits into
go-gitea:release/v1.13from
6543-forks:backport_mail-validation

Conversation

@6543
Copy link
Copy Markdown
Member

@6543 6543 commented Nov 21, 2020

Backport of #13475 including fix #13627

chrisshyi and others added 3 commits November 21, 2020 18:50
* 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>
- move validation into its own function
- use a session for UpdateUserSetting
@6543 6543 mentioned this pull request Nov 21, 2020
@6543 6543 added this to the 1.13.0 milestone Nov 21, 2020
@6543 6543 added the type/enhancement An improvement of existing functionality label Nov 21, 2020
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Nov 22, 2020
@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 Nov 22, 2020
@6543
Copy link
Copy Markdown
Member Author

6543 commented Nov 22, 2020

🚀

@techknowlogick techknowlogick merged commit 33431fc into go-gitea:release/v1.13 Nov 22, 2020
@6543 6543 deleted the backport_mail-validation branch November 22, 2020 17:33
@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.

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.

6 participants