-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangeEmail.py
More file actions
36 lines (30 loc) · 1.21 KB
/
changeEmail.py
File metadata and controls
36 lines (30 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import streamlit as st
import EmailValidation as EV
import SendVerification as SV
from coursegeneration import GenerateCourse
GD = GenerateCourse()
def changeEmailPage():
emailV = EV.EmailValidation()
sendV = SV.SendEmail()
email = st.text_input("Enter the new email")
if st.button("Verify ✔️"):
if not emailV.isValidEmail(email):
GD.show_dialog("Not valid Email")
elif st.session_state.userdoc['email'] != email:
if emailV.isDublicated(email):
GD.show_dialog("Email is already used")
else:
if sendV.is_Outlook(email):
st.session_state.verification_code = sendV.send_To_Outlook(email)
else:
st.session_state.verification_code = sendV.send_To_Gmail(email)
# todo
st.session_state.userdoc['email'] = email
st.session_state.email = email
st.session_state.page = "emailver2"
st.experimental_rerun()
else:
GD.show_dialog("the email can't be the same")
if st.button('Home 🏠'):
st.session_state.page = "user"
st.rerun()