Skip to main content

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 Downloads

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:

connect
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:

  1. self
  2. credentials : The credentials to connect with Google Sheets API. you have to enable Google Sheets API and create credentials, visit : Google Cloud Console
  3. smtp_username : username to login to your SMTP Gmail account
  4. smtp_password : password to login to your SMTP Gmail account
  5. company_name : This is the name of the person/ organization which will send the password reset email.
  6. width : Width of the animation on the login page.
  7. height : Height of the animation on the login page.
  8. logout_button_name : The logout button name.
  9. hide_menu_bool : Pass True if the streamlit menu should be hidden.
  10. hide_footer_bool : Pass True if the 'made with streamlit' footer should be hidden.
  11. 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.

connect

Create Account page

Stores the user info in a secure way in the google-sheet file. as a database \

creat-account

Forgot Password page

After user authentication (email), triggers an email to the user containing a random password. \

get-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. \

edit-password

Logout button

Generated in the sidebar only if the user is logged in, allows users to logout. \

loggin

Cookies are automatically created and destroyed depending on the user authentication status.

Version

v1.3.3

License

MIT

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

streamlit_signin_auth_ui-1.3.3.tar.gz (11.8 kB view hashes)

Uploaded Source

Built Distribution

streamlit_signin_auth_ui-1.3.3-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page