def create_user_token(user): try: future_datetime = current_datetime() + datetime.timedelta(days=14) user_token = UserToken.objects.create(user_id=user.id, token=get_random_token(), expires_at=future_datetime) return user_token except: #error creating user token print traceback.print_exc() return None
def salt(): return get_random_token()