Login/Sign-up page with Streamlit,the user's data are stored in a Google Sheets file as database,also the lables of widgets are in Frensh language.
Project description
Login page with Streamlit (Lables of widgets are in Frensh language)
Update of https://github.com/GitSamad88
#Version 2024-3-29 : this version is an update of streamlit-login-auth-ui-23
- streamlit 3.31.1
- trimmed requirements.txt
- removed name from user
- attempt to fix cache deprecated in imported module streamlit-cookies-manager==0.2.0 latest Version!
- store user's authentifications in a Google Sheets file as a database.
- connect with the user using STMP Gmail.
HOW TO INSTALL ALL LIBRARIES:? python3.10 -m venv venv source venv/bin/activate python3.10 -m pip install -r requirements.txt
Streamlit Login/ Sign Up Library
The streamlit_signin_auth_ui library is meant for streamlit application developers. It lets you connect your streamlit application to a pre-built and secure Login/ Sign-Up page and store user's data in Google Sheets.
You can customize specific parts of the page without any hassle!
The library grants users an option to reset their password, users can click on Forgot Password?
after which an Email is triggered containing a temporary, randomly generated password.
The library also sets encrypted cookies to remember and automatically authenticate the users without password.
The users can logout using the Sortir
button.
Authors
PyPi
https://pypi.org/project/streamlit_signin_auth_ui/
The UI:
pip install streamlit_signin_auth_ui
How to implement the library?
To import the library, just paste this at the starting of the code:
from streamlit_signin_auth_ui.widgets import __login__
All you need to do is create an object for the __login__
class and pass the following parameters:
- self
- credentials : The credentials to connect with Google Sheets API. you have to enable Google Sheets API and create credentials, visit : Google Cloud Console
- smtp_username : username to login to your SMTP Gmail account
- smtp_password : password to login to your SMTP Gmail account
- company_name : This is the name of the person/ organization which will send the password reset email.
- width : Width of the animation on the login page.
- height : Height of the animation on the login page.
- logout_button_name : The logout button name.
- hide_menu_bool : Pass True if the streamlit menu should be hidden.
- hide_footer_bool : Pass True if the 'made with streamlit' footer should be hidden.
- lottie_url : The lottie animation you would like to use on the login page. Explore animations
Mandatory Arguments:
company_name
width
height
Non Mandatory Arguments:
logout_button_name
[default = 'Sortir']hide_menu_bool
[default = False]hide_footer_bool
[default = False]lottie_url
[default = https://assets8.lottiefiles.com/packages/lf20_ktwnwv5m.json]
After doing that, just call the build_login_ui()
function using the object you just created and store the return value in a variable.
Example:
import streamlit as st
from streamlit_signin_auth_ui.widgets import __login__
__login__obj = __login__(credentials=credentials_of_your_google_sheet_API, # must be .json or Python dictionnary.
smtp_username = 'your_email@gmail.com',
smtp_password = 'your password', # 16 caracters
company_name = "your_company_name", # mandatory
width = 400, height = 500,
logout_button_name = 'Sortir', hide_menu_bool = False,
hide_footer_bool = False,
lottie_url = 'https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json')
LOGGED_IN = __login__obj.build_login_ui()
if LOGGED_IN == True:
st.success("Bienvenue!")
That's it! The library handles the rest.
Just make sure you call/ build your application indented under if st.session_state['LOGGED_IN'] == True:
, this guarantees that your application runs only after the user is securely logged in.
Explanation
Login page
The login page, authenticates the user.
Create Account page
Stores the user info in a secure way in the google-sheet
file. as a database \
Forgot Password page
After user authentication (email), triggers an email to the user containing a random password. \
Reset Password page
After user authentication (email and the password shared over email), resets the password and updates the same
in the google-sheet
file. \
Logout button
Generated in the sidebar only if the user is logged in, allows users to logout. \
Cookies are automatically created and destroyed depending on the user authentication status.
Version
v1.3.3
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for streamlit_signin_auth_ui-1.3.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 799ba995a6e8b353da0ab2a9b6df9c536126425c63cd0ca46d44b4b68bd7dabf |
|
MD5 | 1dbc3d443898427192f756b0ad205226 |
|
BLAKE2b-256 | 71432f6c22bd1a2b92f641f11fb1537c2db4c1878b3c562b71e6e96561c8d9d6 |
Hashes for streamlit_signin_auth_ui-1.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aa01ff34fb7aa45d30a518d91a0a8b06d0235dbe4aa1c3fcad97a50c0275ae3 |
|
MD5 | 2ba2cea4ee23e223fd9604d87aea555a |
|
BLAKE2b-256 | 1788f5840a97ca14c42cbd71bfaba27fccd557a644dddfabd95e6ed5dad4a75b |