diff options
| author | Bobby <[email protected]> | 2024-06-13 19:31:04 +0000 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-06-13 19:31:04 +0000 |
| commit | c27b2930170dbc69d5b2c302bff2eba6b97a5525 (patch) | |
| tree | 2c29f50b15926c41de662791182091fab1a2d2dc /users/accountFunctions.py | |
| parent | 77275c2c688aa1f337659d98255582627450d43f (diff) | |
| download | thatcomputerscientist-c27b2930170dbc69d5b2c302bff2eba6b97a5525.tar.xz thatcomputerscientist-c27b2930170dbc69d5b2c302bff2eba6b97a5525.zip | |
Ability to Reset Passwords and Better Email Templates
Diffstat (limited to 'users/accountFunctions.py')
| -rw-r--r-- | users/accountFunctions.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/users/accountFunctions.py b/users/accountFunctions.py index f5d77d72..38bc7099 100644 --- a/users/accountFunctions.py +++ b/users/accountFunctions.py @@ -28,12 +28,18 @@ def store_token(token_type, user, email=None): token_store.save() return uid, token -def verify_token(token_type, uid, token): +def verify_token(token_type, uid, token, hold_verification=False): try: token_store = TokenStore.objects.get(token_type=token_type, uid=uid, token=token) if token_store.expires > timezone.now() and not token_store.verified and token_store.token_type == token_type and token_store.uid == uid and token_store.token == token: + + if hold_verification: + return token_store token_store.verified = True - UserProfile.objects.filter(user=token_store.user).update(email_verified=True) + + if token_type == "verifyemail": + UserProfile.objects.filter(user=token_store.user).update(email_verified=True) + token_store.save() return token_store |
