1mpreccable commited on
Commit
378ebdc
·
1 Parent(s): 7bdb9e5
app.py CHANGED
@@ -1,47 +1,47 @@
1
- import streamlit as st
2
- import streamlit_authenticator as stauth
3
- import os
4
 
5
- admin_email = os.getenv("ADMIN_EMAIL")
6
- admin_pass = os.getenv("ADMIN_PASS")
7
- admin_username = os.getenv("ADMIN_USERNAME")
8
- cookie_signature_key = os.getenv("COOKIE_SIGNATURE_KEY")
9
 
10
 
11
- credentials = {
12
- 'usernames': {
13
- 'impreccable': {
14
- 'email': admin_email,
15
- 'name': admin_username,
16
- 'password': admin_pass
17
- }
18
- }
19
- }
20
 
21
- cookie_config = {
22
- 'name': 'some_cookie_name',
23
- 'key': cookie_signature_key,
24
- 'expiry_days': 30
25
- }
26
 
27
- authenticator = stauth.Authenticate(
28
- credentials,
29
- cookie_config['name'],
30
- cookie_config['key'],
31
- cookie_config['expiry_days']
32
- )
33
 
34
- try:
35
- authenticator.login()
36
 
37
- if st.session_state['authentication_status']:
38
- st.session_state['logged_in'] = True
39
- authenticator.logout()
40
- st.write(f'Welcome *{st.session_state["name"]}*')
41
- st.title('Some content')
42
- elif st.session_state['authentication_status'] is False:
43
- st.error('Username/password is incorrect')
44
- elif st.session_state['authentication_status'] is None:
45
- st.warning('Please enter your username and password')
46
- except KeyError:
47
- st.error('Please check your configuration file')
 
1
+ # import streamlit as st
2
+ # import streamlit_authenticator as stauth
3
+ # import os
4
 
5
+ # admin_email = os.getenv("ADMIN_EMAIL")
6
+ # admin_pass = os.getenv("ADMIN_PASS")
7
+ # admin_username = os.getenv("ADMIN_USERNAME")
8
+ # cookie_signature_key = os.getenv("COOKIE_SIGNATURE_KEY")
9
 
10
 
11
+ # credentials = {
12
+ # 'usernames': {
13
+ # 'impreccable': {
14
+ # 'email': admin_email,
15
+ # 'name': admin_username,
16
+ # 'password': admin_pass
17
+ # }
18
+ # }
19
+ # }
20
 
21
+ # cookie_config = {
22
+ # 'name': 'some_cookie_name',
23
+ # 'key': cookie_signature_key,
24
+ # 'expiry_days': 30
25
+ # }
26
 
27
+ # authenticator = stauth.Authenticate(
28
+ # credentials,
29
+ # cookie_config['name'],
30
+ # cookie_config['key'],
31
+ # cookie_config['expiry_days']
32
+ # )
33
 
34
+ # try:
35
+ # authenticator.login()
36
 
37
+ # if st.session_state['authentication_status']:
38
+ # st.session_state['logged_in'] = True
39
+ # authenticator.logout()
40
+ # st.write(f'Welcome *{st.session_state["name"]}*')
41
+ # st.title('Some content')
42
+ # elif st.session_state['authentication_status'] is False:
43
+ # st.error('Username/password is incorrect')
44
+ # elif st.session_state['authentication_status'] is None:
45
+ # st.warning('Please enter your username and password')
46
+ # except KeyError:
47
+ # st.error('Please check your configuration file')
pages/3_encrypting.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from src.functions import get_shift, normalize_text, vigenere_encrypt, vigenere_decrypt
3
+
4
+ st.title('Vigenère Cipher Encryption')
5
+
6
+ text = st.text_area('Enter text to encrypt:')
7
+ key = st.text_input('Enter encryption key:')
8
+
9
+ if st.button('Encrypt'):
10
+ if text and key:
11
+ normalized_text = normalize_text(text)
12
+ normalized_key = normalize_text(key)
13
+ if normalized_text and normalized_key:
14
+ encrypted_text = vigenere_encrypt(normalized_text, normalized_key)
15
+ st.success(f'Encrypted text: {encrypted_text}')
16
+ else:
17
+ st.error('Text or key contains invalid characters.')
18
+ else:
19
+ st.error('Please enter both text and key.')
src/__pycache__/functions.cpython-312.pyc ADDED
Binary file (3.44 kB). View file