Commit graph

18 commits

Author SHA1 Message Date
6543
f915161a2f
skip email validation on empty string ()
- move validation into its own function
- use a session for UpdateUserSetting
2020-11-20 23:45:55 +02:00
Chris Shyi
d025d84d91
Add email validity check ()
* 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>
2020-11-14 11:53:43 -05:00
Lunny Xiao
1645d4a5d8
Use ID or Where to instead directly use Get when load object from database ()
* 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>
2020-06-17 20:50:11 +03:00
guillep2k
5e1438ba92
Admin page for managing user e-mail activation ()
* 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>
2020-03-02 15:25:36 -03:00
guillep2k
cfcd8e4146
Ensure only own addresses are updated () 2020-02-21 10:08:04 -03:00
kolaente
f9ec2f89f2 Add golangci () 2019-06-12 15:41:28 -04:00
Ethan Koenig
aa962deec0 Replace deprecated Id method with ID () 2017-10-05 07:43:04 +03:00
Lunny Xiao
dd55534b82 Reduce usage of allcols on update ()
* reduce usage of allcols on update

* fix bug and tests
2017-09-25 12:59:27 +08:00
Lauris BH
6db387a21e Refactor session close as xorm already does everything needed internally () 2017-06-21 08:57:05 +08:00
Ethan Koenig
1207bda94b Fix typos in models/ () 2017-01-05 08:50:34 +08:00
Denis Denisov
380e32e129 Fix random string generator ()
* 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
2016-12-20 13:32:02 +01:00
Lunny Xiao
b4c794058a fixed vulnerabilities () 2016-12-15 16:49:06 +08:00
Bwko
a4ece1f223 Fixes typos 2016-11-27 12:59:12 +01:00
Bwko
066f515a47 Lint models/user_email.go 2016-11-26 01:03:06 +01:00
Lunny Xiao
555d8b16cb fixed bug caused Find should be Get () 2016-11-12 00:01:09 +01:00
Thibault Meyer
a4454f5d0f
Rewrite XORM queries 2016-11-10 20:59:51 +01:00
Unknwon
1f2e173a74 Refactor User.Id to User.ID 2016-07-24 01:08:22 +08:00
Unknwon
52322ef624 models/user_mail: refactor EmailAddress 2016-07-16 10:08:04 +08:00