Metadata-Version: 2.1
Name: streamlit-admin
Version: 0.1.0
Summary: Basic User Admin and Authenticator for Streamlit
Home-page: https://github.com/duducosmos/streamlit_admin
Author: Eduardo S. Pereira
Author-email: pereira.somoza@gmail.com
License: Apache License 2.0
Platform: UNKNOWN
Description-Content-Type: text/markdown
Requires-Dist: bcrypt
Requires-Dist: pandas
Requires-Dist: pydal
Requires-Dist: streamlit

# Basic Authenticator for Streamlit Using Database

Loggin system based on pydal to connect Database.
First user is Admin.

Usage Example

```python
STAuthView(databaseInfo, databaseFolder)
```

databaseInfo -> see list of database \
databaseFolder -> Folder to save data base info and data

## User table 

The basic authentication create the following user table:
```python
database.define_table("users",
                        Field("username", "string", unique=True),
                        Field("email", "string", unique=True),
                        Field("password", "string"),
                        Field("role", "string", default="guest")
                        )

```

## Usage Example

```python
import streamlit as st

from streamlit_admin import AdminUsers, STAuth

# 
auth = STAuth('sqlite://storage.db', './database')
admin = AdminUsers(auth)

if admin.session_state['loggedIn'] == False:
    admin.login_page()
else:
    admin.logout_page()
    st.write("Oi Mundo")

```
### Login Page
![Loggin](./images/init_page.png)

### Sign (Create User) Page
![Loggin](./images/sigin.png)

### Home Page with logout button

![Loggin](./images/logged.png)

## List of Database:

SQLite	sqlite://storage.sqlite \
MySQL	mysql://username:password@localhost/test?set_encoding=utf8mb4 \
PostgreSQL	postgres://username:password@localhost/test \
MSSQL (legacy)	mssql://username:password@localhost/test \
MSSQL (>=2005)	mssql3://username:password@localhost/test \
MSSQL (>=2012)	mssql4://username:password@localhost/test \
FireBird	firebird://username:password@localhost/test \
Oracle	oracle://username/password@test \
DB2	db2://username:password@test \ 
Ingres	ingres://username:password@localhost/test \
Sybase	sybase://username:password@localhost/test \
Informix	informix://username:password@test \
Teradata	teradata://DSN=dsn;UID=user;PWD=pass;DATABASE=test \
Cubrid	cubrid://username:password@localhost/test \
SAPDB	sapdb://username:password@localhost/test \
IMAP	imap://user:password@server:port \
MongoDB	mongodb://username:password@localhost/test \
Google/SQL	google:sql://project:instance/database \
Google/NoSQL	google:datastore \
Google/NoSQL/NDB	google:datastore+ndb 



