Spaces:
Sleeping
Sleeping
a-v-bely
commited on
Commit
·
d35b11d
1
Parent(s):
adf7190
Add timestamp for registration
Browse files
utilities_database/user_database_utils.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import re
|
| 2 |
import secrets
|
| 3 |
-
import requests
|
| 4 |
import pandas as pd
|
| 5 |
import streamlit as st
|
| 6 |
from trycourier import Courier
|
|
@@ -25,16 +24,6 @@ def check_usr_pass(user_log_in_database, user_name: str, password: str) -> bool:
|
|
| 25 |
return False
|
| 26 |
|
| 27 |
|
| 28 |
-
def load_lottie_url(url: str) -> str or None:
|
| 29 |
-
"""
|
| 30 |
-
Fetches the lottie animation using the URL.
|
| 31 |
-
"""
|
| 32 |
-
r = requests.get(url)
|
| 33 |
-
if r.status_code != 200:
|
| 34 |
-
return None
|
| 35 |
-
return r.json()
|
| 36 |
-
|
| 37 |
-
|
| 38 |
def check_valid_name(name_sign_up: str) -> bool:
|
| 39 |
"""
|
| 40 |
Checks if the user entered a valid name while creating the account.
|
|
@@ -100,7 +89,7 @@ def check_unique_usr(user_log_in_database, user_name_sign_up: str):
|
|
| 100 |
|
| 101 |
|
| 102 |
def register_new_usr(user_log_in_database, name_sign_up: str, email_sign_up: str, user_name_sign_up: str,
|
| 103 |
-
password_sign_up: str, professional_level: str) -> None:
|
| 104 |
"""
|
| 105 |
Saves the information of the new user in the _secret_auth.json file.
|
| 106 |
"""
|
|
@@ -108,7 +97,8 @@ def register_new_usr(user_log_in_database, name_sign_up: str, email_sign_up: str
|
|
| 108 |
'name': name_sign_up,
|
| 109 |
'e-mail': email_sign_up,
|
| 110 |
'password': ph.hash(password_sign_up),
|
| 111 |
-
'professional_level': professional_level
|
|
|
|
| 112 |
|
| 113 |
return user_log_in_database.put(new_usr_data)
|
| 114 |
|
|
|
|
| 1 |
import re
|
| 2 |
import secrets
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import streamlit as st
|
| 5 |
from trycourier import Courier
|
|
|
|
| 24 |
return False
|
| 25 |
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
def check_valid_name(name_sign_up: str) -> bool:
|
| 28 |
"""
|
| 29 |
Checks if the user entered a valid name while creating the account.
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
def register_new_usr(user_log_in_database, name_sign_up: str, email_sign_up: str, user_name_sign_up: str,
|
| 92 |
+
password_sign_up: str, professional_level: str, timestamp: str) -> None:
|
| 93 |
"""
|
| 94 |
Saves the information of the new user in the _secret_auth.json file.
|
| 95 |
"""
|
|
|
|
| 97 |
'name': name_sign_up,
|
| 98 |
'e-mail': email_sign_up,
|
| 99 |
'password': ph.hash(password_sign_up),
|
| 100 |
+
'professional_level': professional_level,
|
| 101 |
+
'time_stamp': timestamp}
|
| 102 |
|
| 103 |
return user_log_in_database.put(new_usr_data)
|
| 104 |
|
utilities_database/user_database_widgets.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from deta import Deta
|
| 2 |
import streamlit as st
|
|
|
|
| 3 |
from utilities_option_menu.option_menu import option_menu
|
| 4 |
import utilities_database.user_database_utils as db_utils
|
| 5 |
from utilities_database.user_database_utils import check_usr_pass
|
|
@@ -161,7 +162,8 @@ class LogIn:
|
|
| 161 |
email_sign_up=email_sign_up,
|
| 162 |
user_name_sign_up=user_name_sign_up,
|
| 163 |
password_sign_up=password_sign_up,
|
| 164 |
-
professional_level=professional_level
|
|
|
|
| 165 |
st.success("Регистрация прошла успешно!")
|
| 166 |
|
| 167 |
def forgot_password(self) -> None:
|
|
|
|
| 1 |
from deta import Deta
|
| 2 |
import streamlit as st
|
| 3 |
+
from datetime import datetime
|
| 4 |
from utilities_option_menu.option_menu import option_menu
|
| 5 |
import utilities_database.user_database_utils as db_utils
|
| 6 |
from utilities_database.user_database_utils import check_usr_pass
|
|
|
|
| 162 |
email_sign_up=email_sign_up,
|
| 163 |
user_name_sign_up=user_name_sign_up,
|
| 164 |
password_sign_up=password_sign_up,
|
| 165 |
+
professional_level=professional_level,
|
| 166 |
+
timestamp=str(datetime.now())[:-7])
|
| 167 |
st.success("Регистрация прошла успешно!")
|
| 168 |
|
| 169 |
def forgot_password(self) -> None:
|