Commit graph

407 commits

Author SHA1 Message Date
Son NK
f56b0cddb2 use exception log for /alias/options endpoints 2020-10-15 16:02:04 +02:00
Son NK
7e425c0338 disable login if user is disabled 2020-10-04 12:49:43 +02:00
Son NK
d81ad2fd12 sanitize mailbox before creating: remove empty space 2020-09-17 17:02:50 +02:00
Son NK
c625a178e8 use RequestException instead of ConnectionError 2020-09-11 16:55:32 +02:00
Son NK
d1eb1ea799 handle case apple server not accessible 2020-09-05 20:56:03 +02:00
Son NK
5cf0a4bcfe handle case alias can be None in toggle_alias 2020-09-05 20:54:08 +02:00
Son NK
2d395f99bb make sure to remove whitespace in alias 2020-09-02 09:56:16 +02:00
Son NK
a3d919db2e take into account mailbox in alias search 2020-08-29 19:03:33 +02:00
Son NK
fdedc24358 black new version 2020-08-27 10:20:48 +02:00
Son NK
4101142253 black 2020-08-26 11:45:24 +02:00
Son NK
f213469e9f display nb-reply, nb-forward on alias contact page 2020-08-26 11:45:07 +02:00
Son NK
9237f43c19 use warning log level for tampered alias 2020-08-24 19:58:21 +02:00
Son NK
00a08d898a refactor: do not use latest_activity in subquery 2020-08-21 23:10:23 +02:00
Son NK
d7583f1733 handle case where alias does not have any activity in get_alias_infos_with_pagination_v3 2020-08-21 20:39:18 +02:00
Son NK
30fe09185f create get_alias_infos_with_pagination_v3 - reduce nb queries used in get_alias_infos_with_pagination_v2 2020-08-21 19:51:48 +02:00
Son NK
c74857c7e7 use alias name when searching 2020-08-07 09:56:44 +02:00
Son NK
2f00294ba3 replace pgp_enabled by disable_pgp 2020-08-06 14:22:28 +02:00
Son NK
a3051b3d45 black 2020-08-04 20:12:15 +02:00
Son NK
b3ca7d1d5b Return pgp_enabled in GET /api/v2/aliases 2020-08-04 20:11:59 +02:00
Son NK
03841693ba Return support_pgp in GET /api/v2/aliases 2020-08-04 20:09:42 +02:00
Son NK
ed22f5116f fix api key counter not correctly incremented 2020-08-01 10:14:59 +02:00
Son NK
6437ee46e0 use LOG.exception instead of LOG.error to provide stacktrace 2020-07-17 12:59:07 +02:00
Son NK
8f17cda794 use warning error for alias expiration error 2020-07-13 20:40:26 +02:00
Son NK
28c96d0d35 return 412 when alias ceration time is expired 2020-07-11 19:23:56 +02:00
Son NK
d59e9a6238 use warning level for apple server issue 2020-07-04 18:24:34 +02:00
Son NK
d0776b770f add GET /api/logout 2020-07-04 12:10:04 +02:00
Son NK
0d3a3e0c48 Create POST /api/api_key 2020-07-04 11:41:31 +02:00
Son NK
5b3ec91300 login user in api auth endpoints 2020-07-04 10:39:38 +02:00
Son NK
40b4273111 take into account /verifyReceipt can return 5** 2020-06-30 20:10:12 +02:00
Son NK
204f5f9a0c fix alias can be none in delete alias endpoint 2020-06-28 09:48:21 +02:00
Son NK
02bd45bc4a fix alias can be none in update alias endpoint 2020-06-28 09:48:21 +02:00
Son NK
c91b44fa97 set rate limit to 5/minute on new alias routes 2020-06-24 10:32:22 +02:00
Son NK
774ffcae3b enable CORS on /api endpoints 2020-06-24 10:30:01 +02:00
Son NK
45a8b360e4 handle case where alias is None 2020-06-19 23:44:16 +02:00
Son NK
ee6a1a672d fix POST /v2/alias/custom/new when DISABLE_ALIAS_SUFFIX is set 2020-06-15 23:35:20 +02:00
Son NK
1a22d0cf9b fix domain can be null in self-hosting
# Conflicts:
#	app/api/views/new_custom_alias.py
#	app/dashboard/views/custom_alias.py
2020-06-15 15:58:05 +02:00
Son NK
dfe708b4fb return user email in /api/auth/mfa 2020-06-09 17:20:37 +02:00
Son NK
0002531bc0 return user email in /api/auth/login 2020-06-09 17:19:03 +02:00
Son NK
ce4992c7fb check if alias exists 2020-06-07 12:50:30 +02:00
Son NK
9fc0748fcc Support setting alias name in POST /api/v3/alias/custom/new 2020-06-03 21:22:29 +02:00
Son NK
48dc0dd1cc change mailboxes to mailbox_ids 2020-06-02 20:06:32 +02:00
Son NK
d055989239 Create POST /api/v3/alias/custom/new 2020-06-02 09:33:56 +02:00
Son NK
48998ff07e return nb_alias in GET /mailboxes 2020-05-31 11:52:01 +02:00
Son NK
0530a8aab5 return creation_timestamp in GET /mailboxes 2020-05-31 11:49:53 +02:00
Son NK
78d9a88328 Add default field to GET /api/mailboxes 2020-05-27 14:18:20 +02:00
Sibren Vasse
31a1f94a5f Implement rate limiting 2020-05-25 11:39:33 +02:00
Son NK
1e03f26cfa Return whether there's more notification in GET /api/notifications 2020-05-23 22:51:00 +02:00
Son NK
dae357dd6b Add GET /api/notifications, /api/notifications/:notification_id 2020-05-23 19:54:06 +02:00
Son NK
adce27b88b Add DomainDeletedAlias.get_by check when creating custom alias 2020-05-23 19:49:40 +02:00
Son NK
1d598252e7 format 2020-05-23 19:18:50 +02:00
Son NK
6fc380c0d9 remove unused imports 2020-05-23 19:18:35 +02:00
Son NK
42b3666f45 use the alias v2 format for GET /api/aliases/:alias_id, POST /api/v2/alias/custom/new, POST /api/v2/alias/random/new 2020-05-23 19:18:24 +02:00
Son NK
6280512adf move get mailboxes to mailbox.py 2020-05-23 16:46:10 +02:00
Son NK
3eb6700232 user can cancel mailbox email change 2020-05-23 16:43:48 +02:00
Son NK
2f087de061 can update mailbox email 2020-05-23 16:40:28 +02:00
Son NK
a76ad0485f PUT /api/mailboxes/:mailbox_id: update mailbox 2020-05-23 16:26:26 +02:00
Son NK
5ae39c85c6 Add DELETE /api/mailboxes/:mailbox_id 2020-05-23 16:18:12 +02:00
Son NK
722bff319e add POST /api/mailboxes: create a new mailbox 2020-05-23 16:17:42 +02:00
Son NK
2fbc2c171b check domain trash when creating custom alias in api 2020-05-23 12:02:01 +02:00
Son NK
cb036f651d do not call lower() on signed_suffix 2020-05-20 18:23:13 +02:00
Son NK
93d972df09 make sure to use lowercase for alias email 2020-05-20 18:12:14 +02:00
Son Nguyen Kim
1997c207ed
Merge pull request #196 from SibrenVasse/error_handling
Move api error handling to global error handler
2020-05-17 18:02:23 +02:00
Sibren Vasse
2d7bd225e9 Move api error handling to global error handler 2020-05-17 15:27:24 +02:00
Son NK
b167297808 Support disable_pgp in update alias endpoint 2020-05-16 20:51:07 +02:00
Son NK
362d101bab Merge branch 'master' into multiple-mailboxes
# Conflicts:
#	app/dashboard/templates/dashboard/custom_alias.html
#	email_handler.py
#	templates/emails/com/newsletter/mobile-darkmode.html
2020-05-16 11:28:25 +02:00
Son NK
7ed77a66b2 format 2020-05-15 23:18:42 +02:00
Son NK
2978bfb281 Fix user cannot change personal email back and better naming.
Happens when user
- changes their personal email
- wants to change back: they can't as this email is already used as mailbox
2020-05-15 23:18:30 +02:00
Son NK
0b652cf3f8 remove AliasMailbox.user_id column 2020-05-15 16:35:57 +02:00
Son NK
355b4dc2cf remove too verbose log 2020-05-15 15:30:19 +02:00
Son NK
ee19957d5d Add 405 error 2020-05-13 23:28:00 +02:00
Son NK
5c8c741a6a API Error handling for 404 and 500 2020-05-13 22:02:38 +02:00
Son NK
e6c37cad0b Handle case where data["receipt"]["in_app"] is empty 2020-05-13 21:41:34 +02:00
Son NK
2b71fee712 use warning log level for "No existing AppleSub" error 2020-05-13 21:38:25 +02:00
Son NK
90dae2e3c8 Support mailbox_ids in PUT /api/aliases/:alias_id 2020-05-10 20:09:54 +02:00
Son NK
165d986561 add mailboxes to GET /api/v2/aliases 2020-05-10 20:09:54 +02:00
Son NK
47430725a7 improve doc 2020-05-10 20:09:54 +02:00
Son NK
b95b758692 Optimize imports 2020-05-09 20:49:38 +02:00
Son Nguyen Kim
b95d815e5c
Merge pull request #168 from simple-login/global-trash
Global trash
2020-05-09 18:08:51 +02:00
Son NK
e68eab44b0 allow user who has TOTP enabled to continue using the mobile app 2020-05-08 20:23:13 +02:00
Son NK
2f5a03dcad make sure to add alias into global trash when deleting it 2020-05-07 22:27:27 +02:00
Son NK
f929f23acc return 403 if user enables FIDO 2020-05-07 21:54:36 +02:00
Son NK
806f7016ae fix: wrongly set alias custom_domain when custom_domain is in EMAIL_ALIAS 2020-05-07 20:48:11 +02:00
Son NK
35b1972730 increase the expired alias creation session to 600 secs 2020-05-06 10:10:47 +02:00
Son NK
d9e9a54082 add more info in "alias expire" error 2020-05-06 10:09:17 +02:00
Son NK
62bec84900 Add obsolete warnings 2020-05-02 16:23:40 +02:00
Son NK
d32669f515 Add /api/v2/alias/custom/new 2020-05-02 16:22:17 +02:00
Son NK
72e9b52b29 Add /api/v4/alias/options 2020-05-02 16:21:18 +02:00
Son NK
0edcc25289 refactor verify_prefix_suffix: remove user_custom_domains param 2020-05-02 12:27:54 +02:00
Son NK
95a90a9979 use log warning for verifyReceipt 2020-05-01 18:31:06 +02:00
Son NK
9be813b96d fix naming 2020-04-29 16:57:28 +02:00
Son NK
8ae51998f5 take into account MacApp 2020-04-29 15:50:06 +02:00
Son NK
7b2e4da87f Support alias filter 2020-04-26 13:04:27 +02:00
Son NK
12714ae601 Add Only enabled alias sorting option 2020-04-26 12:31:10 +02:00
Son NK
4c64393df1 Add other sorting options: A-Z, Z-A, new-old, old-new 2020-04-26 12:25:12 +02:00
Son NK
63af3297f7 return alias name in GET /api/v2/aliases 2020-04-26 10:38:58 +02:00
Son NK
7a2fc007e8 Accept "name" in PUT /api/aliases/:alias_id 2020-04-26 10:38:16 +02:00
Son NK
a422f33323 Add GET /api/mailboxes 2020-04-25 23:42:56 +02:00
Son NK
88ddca54c1 return mailbox in GET /api/v2/aliases 2020-04-25 23:42:56 +02:00
Son NK
97544ac760 Update mailbox using ajax
refactor: return Mailbox in User.mailboxes()
2020-04-25 13:49:40 +02:00
Son NK
489153a750 Support update mailbox_id in PUT /aliases/:aliasID 2020-04-25 13:49:40 +02:00
Son NK
36aee86590 support sorting: Oldest Alias to Newest, 2020-04-25 13:49:39 +02:00
Son NK
ca6350cc27 optimize import in all files 2020-04-25 13:49:39 +02:00
Son NK
1c9d953044 add mailbox to AliasInfo 2020-04-25 13:49:39 +02:00
Son NK
48202e905f rename verify_api_key -> require_api_auth 2020-04-25 13:42:53 +02:00
Son NK
78e94da08c support user already authenticated in verify_api_key 2020-04-25 13:42:53 +02:00
Son NK
7fff8f84d8 add more debug log 2020-04-21 20:17:43 +02:00
Son NK
318b47af36 Handle the case invalid input for /api/apple/update_notification 2020-04-21 15:54:43 +02:00
Son NK
e50b0d5da5 implement apple_update_notification 2020-04-21 09:34:16 +02:00
Son NK
840f827b45 Handle the case "Restore Purchase" on another account 2020-04-19 23:13:43 +02:00
Son NK
d5e868e629 Fix apple payment 2020-04-19 22:54:21 +02:00
Son NK
34635bf854 use Log.error to know when /api/apple/update_notification is called 2020-04-19 16:06:37 +02:00
Son NK
bca1e227c7 Add /apple/update_notification to test Apple notif 2020-04-19 11:50:29 +02:00
Son NK
1bba38edb6 Add POST /apple/process_payment 2020-04-19 11:13:38 +02:00
Son NK
3c9e6fc991 make sure to strip and lower email in input 2020-04-15 21:12:45 +02:00
Son NK
4789e439db rename auth_login to auth 2020-04-09 20:31:53 +02:00
Son NK
5d0519ed86 Add GET /api/v2/aliases 2020-04-06 22:26:35 +02:00
Son NK
425fdc66c6 Move methods to api/serializer.py 2020-04-05 16:32:38 +02:00
Son NK
f15488f96b refactor: move get_alias_infos_with_pagination, get_alias_info to alias.py 2020-04-05 16:21:13 +02:00
Son NK
d1e5b9f9b7 set contact name, use website_email instead of website_from in alias endpoint 2020-04-05 12:58:06 +02:00
Son NK
3baddc9206 rename 2020-04-04 20:04:42 +02:00
Son NK
f7e5ab1e34 reaname 2020-04-04 19:21:31 +02:00
Son NK
4d8040c80d Add reverse_alias to GET /api/aliases/:alias_id/activities 2020-04-04 19:18:07 +02:00
Son NK
5ff8ae00e5 only lower the email part when creating new contact 2020-04-02 21:30:36 +02:00
Son NK
7f85ec30bd Improve contact manager: lowercase the contact address before adding 2020-04-01 20:31:47 +02:00
Son NK
4c1c02db60 Add /v3/alias/options 2020-03-29 23:13:04 +02:00
Son NK
97dff83453 return full alias info in POST /api/alias/random/new 2020-03-26 19:50:22 +01:00
Son NK
d4a32451c1 return full alias info in POST /api/alias/custom/new 2020-03-26 19:48:36 +01:00
Son NK
159aa76aae GET /api/aliases/:alias_id 2020-03-26 19:44:00 +01:00
Son NK
78b24623af reformat: create serialize_alias_info() 2020-03-26 19:35:44 +01:00
Son NK
7d4a9efb5d set user_id when creating AliasUsedOn 2020-03-20 12:29:11 +01:00
Son NK
6e54b4fed8 make sure to set user_id when creating contact 2020-03-20 09:54:38 +01:00
Son NK
b0f2d7b85a always return 200 in /forgot_password 2020-03-18 21:55:50 +01:00
Son NK
a1fad2216f Improve error 2020-03-18 21:37:45 +01:00
Son NK
2079b16431 add "in_trial" to /user_info 2020-03-18 19:08:16 +01:00
Son NK
f2d5230449 Add POST /api/auth/forgot_password 2020-03-18 18:43:04 +01:00
Son NK
ba6b8d2711 return email in /user_info 2020-03-18 18:34:37 +01:00
Son NK
a521002b2c Fix duplicate results 2020-03-17 20:16:20 +01:00
Son NK
a465b1d3ca rename get_alias_info -> get_alias_infos 2020-03-17 19:59:48 +01:00
Son NK
fbef076a14 Take into account query in GET /api/aliases 2020-03-17 19:32:45 +01:00
Son NK
0d725588ae Add DELETE /api/contacts/:contact_id 2020-03-17 19:18:26 +01:00
Son NK
81b5e919a3 Return contact id 2020-03-17 12:38:50 +01:00
Son NK
2d90d35647 rename gen_email_id -> alias_id 2020-03-17 12:01:18 +01:00
Son NK
4f281bdbbb rename GenEmail -> Alias, gen_email to alias whenever possible 2020-03-17 11:51:40 +01:00
Son NK
bea870ef8b rename ForwardEmailLog to EmailLog 2020-03-17 11:10:50 +01:00
Son NK
17974de746 rename ForwardEmail to Contact 2020-03-17 10:56:59 +01:00
Son NK
8faf34ce40 Use warning level for /v2/alias/options 2020-03-16 21:10:53 +01:00
Son Nguyen Kim
1e10b4d675
Merge pull request #113 from simple-login/fix-custom-domain-not-set
Fix custom domain not set
2020-03-15 23:38:25 +01:00
Son NK
ccc005b8b2 Do not set domain for ALIAS_DOMAINS 2020-03-15 23:33:50 +01:00
Son NK
93292c88c9 Fix not setting custom domain when creating alias via API 2020-03-15 23:18:43 +01:00
Son NK
027cbb10d9 use parseaddr instead of get_email_part 2020-03-15 22:32:48 +01:00
Son NK
f87746e071 POST /api/aliases/:alias_id/contacts 2020-03-14 12:55:38 +01:00
Son NK
d7cb5ed26e GET /api/aliases/:alias_id/contacts 2020-03-14 12:22:43 +01:00
Son NK
bfd729b889 PUT /api/aliases/:alias_id 2020-03-14 11:38:39 +01:00
Son NK
ab082a5f9b fix get_json returns 400 2020-03-11 14:02:35 +01:00
Son NK
1098f17c0c Support note in POST /api/alias/random/new 2020-03-11 12:24:30 +01:00
Son NK
aad06f73e9 Support note in POST /api/alias/custom/new 2020-03-11 12:23:43 +01:00
Son NK
417009b3be return note in GET /api/aliases 2020-03-11 12:16:45 +01:00
Son NK
b05daecd28 Handle unsign can generate other exceptions 2020-03-09 09:17:40 +01:00
Son NK
a6f4059d5d make sure to set mailbox_id when creating GenEmail 2020-03-05 17:03:07 +01:00
Son NK
ca70d26285 black format 2020-03-05 11:00:58 +01:00
Son NK
32cd2fd650 Add related endpoints for registration
POST /api/auth/register
POST /api/auth/activate
POST /api/auth/reactivate
2020-02-28 19:02:01 +07:00
Son NK
4d1d236066 add POST /api/auth/google 2020-02-28 17:29:33 +07:00
Son NK
02d26df292 add /api/auth/facebook 2020-02-28 17:26:28 +07:00
Son NK
9d23fc5ab3 small refacto 2020-02-27 22:26:29 +07:00
Son NK
74d1f87db0 disable bounced email in alias log 2020-02-22 13:27:22 +07:00
Son NK
fc167b8b41 Display alias mailbox on alias page 2020-02-10 23:23:02 +07:00
Son NK
e10981f85e able to create word-based or uuid-based in /api/alias/random/new endpoint 2020-02-07 21:30:46 +07:00
Son NK
3092536b40 add GET /api/aliases/:alias_id/activities endpoint 2020-02-05 18:57:11 +07:00
Son NK
c5dc4fec4c add POST /api/aliases/:alias_id/toggle endpoint 2020-02-05 18:28:54 +07:00
Son NK
1241199e23 add "enabled" to returned alias 2020-02-05 18:23:13 +07:00
Son NK
c90a4899d2 Add DELETE /api/aliases/:alias_id endpoint 2020-02-05 18:21:17 +07:00
Son NK
14b48835ae reuse ApiKey if same device 2020-02-05 18:05:26 +07:00
Son NK
40cac56986 GET /api/aliases 2020-02-04 23:26:59 +07:00
Son NK
f7d000d34e alert when /alias/options is used 2020-02-04 23:01:33 +07:00
Son NK
c7903d534a use null instead of "" in /api/auth/login 2020-02-04 18:32:57 +07:00
Son NK
926cc2935c take into account DISABLE_ALIAS_SUFFIX in /api/alias/options 2020-01-22 14:21:01 +01:00
Son NK
bdf75951f1 support ALIAS_DOMAINS
- use verify_prefix_suffix() in /api/alias/custom/new
-
2020-01-22 10:24:17 +01:00
Son NK
ef788f7458 add /api/auth/mfa 2020-01-20 15:00:56 +01:00
Son NK
d1734c3cf9 Create /api/auth/login 2020-01-20 14:51:28 +01:00
Son NK
f52f4c821b Add /api/user_info 2020-01-05 22:48:38 +01:00
Son NK
377e6c657d add /api/alias/random/new 2020-01-05 21:15:16 +01:00
Son NK
c6db8db4a1 Improve error message 2020-01-05 21:14:40 +01:00
Son NK
d322d543af add more check to new custom alias 2020-01-05 20:48:32 +01:00
Son NK
96da841062 add /api/v2/alias/options that flattens the response 2020-01-05 20:47:09 +01:00
Son NK
ca6c32f951 Fix formatting 2019-12-30 15:56:47 +01:00
Tung Nguyen
4f751e5cd2 fix typos and improve messages showing at the end users 2019-12-26 13:00:17 +00:00
Son NK
91e38a744b remove GenEmail.custom column 2019-12-22 16:32:55 +00:00
Son NK
8f04f8ae0f rename can_create_new_custom_alias -> can_create_new_alias 2019-12-22 16:27:55 +00:00
Son NK
9c9ad87c7d remove /api/alias/new 2019-12-15 18:55:18 +02:00
Son NK
565d406227 remove new_random_alias related test 2019-12-15 18:55:18 +02:00
Son NK
e5079e48da remove can_create_new_random_alias() 2019-12-15 18:55:18 +02:00
Son NK
e4ba4297e1 reformat using black 2019-12-15 18:55:18 +02:00
Son NK
631900ab4f use random_word instead of random_string for alias suffix 2019-12-15 18:55:17 +02:00
Son NK
7f6267cc4a call LOG.error on obsolete endpoints: /alias/new and /alias/random/new 2019-12-15 18:55:17 +02:00
Son NK
f37a155c1f still return custom alias option when user runs out of custom alias quota 2019-12-15 18:55:17 +02:00
Son NK
d9c211d8da fix api create new custom alias 2019-12-15 18:55:17 +02:00
Son NK
ca05cd359a remove >3 characters on alias prefix 2019-12-15 18:55:17 +02:00
Son NK
c3056dc94c use website domain name as alias prefix suggestion (instead of full hostname) 2019-12-15 18:55:17 +02:00
Son NK
d4f7b6296d allow alias_prefix shorter 3 characters 2019-12-15 18:55:16 +02:00
Son NK
a9e781da84 use the latest used alias as recommendation 2019-12-15 18:55:16 +02:00
Son NK
d58ab8c808 fix create random alias: new alias not saved 2019-12-15 18:55:16 +02:00
Son NK
8250ab2f22 add /alias/custom/new and /alias/random/new 2019-12-15 18:55:16 +02:00
Son NK
ab4f5bf329 add /api/alias/options 2019-12-15 18:55:16 +02:00
Son NK
6764a4b582 use "default" hostname if hostname is too short 2019-12-15 18:55:16 +02:00
Son NK
79a7985221 handle the case where no hostname is provided in /api/alias/new 2019-12-15 18:55:16 +02:00
Son NK
fd7f819803 allow cross_origin for /api/alias/new 2019-12-15 18:55:16 +02:00
Son NK
6c4a173de5 create /api/alias/new using api-key as authentication 2019-12-15 18:55:16 +02:00