feat: implementacao inicial do sistema LeadRadar
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import streamlit as st
|
||||
from api_client import APIClient
|
||||
|
||||
def render_profile_view(api_client: APIClient):
|
||||
st.title("👤 Meu Perfil & Segurança")
|
||||
|
||||
user_info = st.session_state.get('user', {})
|
||||
|
||||
c1, c2 = st.columns([1, 1])
|
||||
|
||||
with c1:
|
||||
with st.container(border=True):
|
||||
st.subheader("📋 Dados da Conta")
|
||||
st.write(f"**Nome:** {user_info.get('nome', 'N/A')}")
|
||||
st.write(f"**E-mail:** {user_info.get('email', 'N/A')}")
|
||||
st.write(f"**Perfil:** `{user_info.get('role', 'user').upper()}`")
|
||||
st.write(f"**Status da Conta:** {'🟢 Ativo' if user_info.get('ativo') else '🔴 Inativo'}")
|
||||
|
||||
with c2:
|
||||
with st.container(border=True):
|
||||
st.subheader("🔒 Alterar Minha Senha")
|
||||
old_pass = st.text_input("Senha Atual", type="password", key="pwd_old")
|
||||
new_pass = st.text_input("Nova Senha (min 6 caracteres)", type="password", key="pwd_new")
|
||||
confirm_pass = st.text_input("Confirmar Nova Senha", type="password", key="pwd_conf")
|
||||
|
||||
if st.button("🔑 Atualizar Senha", type="primary", use_container_width=True):
|
||||
if not old_pass or not new_pass or not confirm_pass:
|
||||
st.error("Preencha todos os campos de senha.")
|
||||
elif new_pass != confirm_pass:
|
||||
st.error("A nova senha e a confirmação não coincidem.")
|
||||
elif len(new_pass) < 6:
|
||||
st.error("A nova senha deve ter no mínimo 6 caracteres.")
|
||||
else:
|
||||
success, msg = api_client.change_password(old_pass, new_pass)
|
||||
if success:
|
||||
st.success("Senha alterada com sucesso! Faça login com sua nova senha.")
|
||||
else:
|
||||
st.error(msg)
|
||||
Reference in New Issue
Block a user