summaryrefslogtreecommitdiffstats
path: root/models/user_mail.go
Commit message (Collapse)AuthorAgeFilesLines
* Move EmailAddress & UserRedirect into models/user/ (#17607)Lunny Xiao2021-11-111-427/+0
| | | | | | | | | | | | | | | | | | | | | * Move EmailAddress into models/user/ * Fix test * rename user_mail to user_email * Fix test * Move UserRedirect into models/user/ * Fix lint & test * Fix lint * Fix lint * remove nolint comment * Fix lint
* Move login related structs and functions to models/login (#17093)Lunny Xiao2021-09-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move login related structs and functions to models/login * Fix test * Fix lint * Fix lint * Fix lint of windows * Fix lint * Fix test * Fix test * Only load necessary fixtures when preparing unit tests envs * Fix lint * Fix test * Fix test * Fix error log * Fix error log * Fix error log * remove unnecessary change * fix error log * merge main branch
* DBContext is just a Context (#17100)zeripath2021-09-231-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | * DBContext is just a Context This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net> * fix unit tests Signed-off-by: Andrew Thornton <art27@cantab.net> * another place that needs to set the initial context Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid race Signed-off-by: Andrew Thornton <art27@cantab.net> * change attachment error Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-191-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Fix activation of primary email addresses (#16385)Meano2021-07-131-21/+21
| | | | | | | | | | | | | | | | * fix: primary email cannot be activated * Primary email should be activated together with user account when 'RegisterEmailConfirm' is enabled. * To fix the existing error state. When 'RegisterEmailConfirm' is enabled, the admin should have permission to modify the activations status of user email. And the user should be allowed to send activation to primary email. * Only judge whether email is primary from email_address table. * Improve logging and refactor isEmailActive Co-authored-by: zeripath <art27@cantab.net>
* Fix various documentation, user-facing, and source comment typos (#16367)luzpaz2021-07-081-1/+1
| | | | | * Fix various doc, user-facing, and source comment typos Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby`
* Escape reference to `user` table in models.SearchEmails (#16313)Adyanth H2021-06-301-1/+1
| | | | | Fix #16312 Signed-off-by: Adyanth H <adyanthh@gmail.com>
* Always store primary email address into email_address table and also the ↵Lunny Xiao2021-06-081-162/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | state (#15956) * Always store primary email address into email_address table and also the state * Add lower_email to not convert email to lower as what's added * Fix fixture * Fix tests * Use BeforeInsert to save lower email * Fix v180 migration * fix tests * Fix test * Remove wrong submited codes * Fix test * Fix test * Fix test * Add test for v181 migration * remove change user's email to lower * Revert change on user's email column * Fix lower email * Fix test * Fix test
* rsponse 404 when delete not exist email (#15383)a10121127962021-04-101-5/+1
| | | | | fix #15357 Signed-off-by: a1012112796 <1012112796@qq.com>
* chore(models): rewrite code format. (#14754)Bo-Yi Wu2021-03-141-5/+3
| | | | | | | | | | | | | | | * chore: rewrite format. * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: Adjacent parameters with the same type should be grouped together * chore: update format.
* skip email validation on empty string (#13627)65432020-11-201-6/+19
| | | | - move validation into its own function - use a session for UpdateUserSetting
* Add email validity check (#13475)Chris Shyi2020-11-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Use ID or Where to instead directly use Get when load object from database ↵Lunny Xiao2020-06-171-5/+5
| | | | | | | | | | | | (#11925) * Use ID or Where to instead directly use Get when load object from database * Apply suggestions from code review Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Admin page for managing user e-mail activation (#10557)guillep2k2020-03-021-16/+265
| | | | | | | | | | | | | | | | | | | | | | | | * Implement mail activation admin panel * Add export comments * Fix another export comment * again... * And again! * Apply suggestions by @lunny * Add UI for user activated emails * Make new activation UI work * Fix lint * Prevent admin from self-deactivate; add modal Co-authored-by: zeripath <art27@cantab.net>
* Ensure only own addresses are updated (#10397)guillep2k2020-02-211-1/+1
|
* Add golangci (#6418)kolaente2019-06-121-1/+1
|
* Replace deprecated Id method with ID (#2655)Ethan Koenig2017-10-051-2/+2
|
* Reduce usage of allcols on update (#2596)Lunny Xiao2017-09-251-3/+3
| | | | | | * reduce usage of allcols on update * fix bug and tests
* Refactor session close as xorm already does everything needed internally (#2020)Lauris BH2017-06-211-2/+2
|
* Fix typos in models/ (#576)Ethan Koenig2017-01-051-2/+2
|
* Fix random string generator (#384)Denis Denisov2016-12-201-1/+3
| | | | | | | | | | | * Remove unused custom-alphabet feature of random string generator Fix random string generator Random string generator should return error if it fails to read random data via crypto/rand * Fixes variable (un)initialization mixed assign Update test GetRandomString
* fixed vulnerabilities (#392)Lunny Xiao2016-12-151-4/+21
|
* Fixes typosBwko2016-11-271-6/+6
|
* Lint models/user_email.goBwko2016-11-261-1/+7
|
* fixed bug #151 caused Find should be Get (#153)Lunny Xiao2016-11-121-1/+1
|
* Rewrite XORM queriesThibault Meyer2016-11-101-3/+10
|
* Refactor User.Id to User.IDUnknwon2016-07-241-3/+3
|
* models/user_mail: refactor EmailAddressUnknwon2016-07-161-0/+198