Commit graph

65 commits

Author SHA1 Message Date
Daniel Krol
b86687a0c5 Log a couple more things.
Also change sequence=1 to its own const. Eventually we may want to make it variable per user when we do server switching.
2022-08-25 12:43:33 -04:00
Daniel Krol
08d57db466 Add timestamps to accounts and wallets tables
To help diagnosing/debugging in the future
2022-08-23 13:34:31 -04:00
Daniel Krol
4843b91ce7 Rename the output. lbry-id -> wallet-sync-server 2022-08-22 12:05:53 -04:00
Daniel Krol
aa691dbc09 Use verify_token=null as verified to avoid unique constraint
We were using verify_token="" to mean that the user was verified. We need a unique constraint on verify_token to prevent two users from getting the same verify link in their email. This means that if we have two verified users, they will both have verify_token="", which triggers the unique constraint. Oops. However, null is an exception to unique constraints, so we're now using that instead to mean verified.
2022-08-13 22:15:19 -04:00
Daniel Krol
e2893c13e3 Add test to confirm that we can create two accounts on the server. 2022-08-13 19:37:54 -04:00
Daniel Krol
f60e5659b6 Don't update verify tokens if the account is already verified 2022-07-31 14:13:30 -04:00
Daniel Krol
39144aa3c0 Comment assumptions on store functions 2022-07-31 13:54:40 -04:00
Daniel Krol
aa1361a5fa Human-friendly output for verify account endpoint 2022-07-31 12:59:46 -04:00
Daniel Krol
ea3b04eff6 store.VerifyToken 2022-07-31 12:42:03 -04:00
Daniel Krol
2dd3019b08 store.UpdateVerifyTokenString 2022-07-31 12:26:03 -04:00
Daniel Krol
eabfa9d54c No password change for unverified accounts 2022-07-30 23:09:33 -04:00
Daniel Krol
4a205bbda7 GetUserId - Return error if account unverified 2022-07-30 15:06:27 -04:00
Daniel Krol
dee2882fe9 Verify token db fields, CreateAccount changes 2022-07-30 14:24:33 -04:00
Daniel Krol
5ffcddf8f7 Endpoint to re-send verify token string 2022-07-29 20:49:00 -04:00
Daniel Krol
19396e9797 Make error message more accurate. Rename test. 2022-07-29 15:52:23 -04:00
Daniel Krol
6672175a25 Server test/implement send verify-account email 2022-07-27 19:45:09 -04:00
Daniel Krol
f15875c4a6 Verify account endpoint 2022-07-26 16:36:57 -04:00
Daniel Krol
aee351a2b1 Don't allow password change for unverified accounts
Mainly because wallet change is tied up in it
2022-07-26 11:18:43 -04:00
Daniel Krol
5985631410 Don't hand out auth tokens if they're not verified 2022-07-26 10:53:31 -04:00
Daniel Krol
55db62e2f9 Register endpoint handles "verified" status
Based on the verification mode specified in env. The db doesn't do anything with it yet.
2022-07-26 10:16:44 -04:00
Daniel Krol
aefda1245b Make emails case insensitive (for now).
Prevents duplicate accounts. Also allows case insensitive search (user id, salt seed, etc) while still having an index. This is done by storing normalized as a separate field from originally formated (which we'll use for sending emails, etc).
2022-07-22 16:29:03 -04:00
Daniel Krol
f10cc8aa26 Salt Seed, used to generate secrets on client 2022-07-21 19:10:16 -04:00
Daniel Krol
4430013bae KDF for server password. Save salt in DB. 2022-07-14 22:04:03 -04:00
Daniel Krol
55686cb7b5 Change module name to new repo account 2022-07-11 22:14:53 -04:00
Daniel Krol
7833015f56 Clear up what ErrNoWallet means 2022-07-11 10:41:18 -04:00
Daniel Krol
f8d51f9b31 Rename file to be more uniform 2022-07-06 15:26:26 -04:00
Daniel Krol
9aa2082a7c Change a check to be like other times I made that check in the file. 2022-07-06 15:22:45 -04:00
Daniel Krol
2b55d0f678 use QueryRow in store.go for cleaner code 2022-07-06 15:15:17 -04:00
Daniel Krol
125e461d95 Change password endpoint implemented and tested 2022-07-06 14:03:59 -04:00
Daniel Krol
02a5b9ce24 store.ChangePasswordNoWallet implement and test 2022-07-05 17:12:14 -04:00
Daniel Krol
41b65d08ab Add test to make sure tokens don't set expiration on error. 2022-07-04 11:50:00 -04:00
Daniel Krol
37fae6436b Create and test password change method
Includes updating the wallet if the user has one
2022-07-04 11:41:08 -04:00
Daniel Krol
8fce2cd868 Don't check that userId is non-zero; it's already handled by ForeignKey constraints 2022-06-29 00:12:01 -04:00
Daniel Krol
a37b64faad Actually put in foreign key constraints! Also test wallet and account empty db fields. 2022-06-29 00:06:43 -04:00
Daniel Krol
fac36a7931 Reject empty fields for insert token 2022-06-28 18:43:43 -04:00
Daniel Krol
098319bc77 Safer and slightly more efficient auth token query 2022-06-27 16:18:16 -04:00
Daniel Krol
dce5f8dd6c Don't use store functions to set up store function tests 2022-06-27 16:10:31 -04:00
Daniel Krol
0a74c67db0 Don't rely on store functions to verify other store functions in tests 2022-06-27 15:59:56 -04:00
Daniel Krol
535799299e Rename test file 2022-06-27 11:39:44 -04:00
Daniel Krol
897ee4b9a7 Move tests around a bit more 2022-06-27 11:36:58 -04:00
Daniel Krol
4b309154c6 Split store tests up 2022-06-27 11:28:39 -04:00
Daniel Krol
ff25de92e7 Make sure we're saving as UTC to the db.
Don't know whether it'd even be an issue, but better not to have a bunch of problems saved in databases.
2022-06-24 14:28:07 -04:00
Daniel Krol
99f17511e4 Test GetUserId 2022-06-24 13:26:21 -04:00
Daniel Krol
6d34f39f12 CreateAccount test and cleanup 2022-06-24 13:15:21 -04:00
Daniel Krol
55b4db0fe8 GetWallet test 2022-06-24 12:19:06 -04:00
Daniel Krol
70b8f1f886 SetWallet tests 2022-06-24 11:59:04 -04:00
Daniel Krol
7af1ea90bc Shorten test strings 2022-06-24 11:32:13 -04:00
Daniel Krol
76d7737341 Split out wallet test init 2022-06-24 11:30:53 -04:00
Daniel Krol
377f598b23 Clean up wallet tests 2022-06-24 11:20:51 -04:00
Daniel Krol
2ff2b7dee0 var name 2022-06-24 11:19:32 -04:00