Skip to main content

master-auth

check auth use mongodb

how to use

install

pip install master_auth

example

from master_auth import core
import os
import dotenv
dotenv.load_dotenv()

MONGODB_USER = os.getenv("MONGODB_USER")
MONGODB_PASSWORD = os.getenv("MONGODB_PASSWORD")
MONGODB_HOST = os.getenv("MONGODB_HOST")
MONGODB_PORT = os.getenv("MONGODB_PORT")
DATABASE_NAME =  os.getenv("APP_NAME") + os.getenv("MONGODB_DATABASE_NAME")
COLLECTION_NAME = "master_auth"

def save_password(username,password):
    result = core.save_password(
        mongodb_username=MONGODB_USER,
        mongodb_password=MONGODB_PASSWORD,
        mongodb_host=MONGODB_HOST,
        mongodb_port=MONGODB_PORT,
        database_name = DATABASE_NAME,
        collection_name = COLLECTION_NAME,
        username = username,
        password = password
    )

    if result:
        print("Password saved successfully!")
        return True
    else:
        print("Username already exists!")
        return False

def update_password(username,password_old,password_new):
    result = core.update_password(
        mongodb_username=MONGODB_USER,
        mongodb_password=MONGODB_PASSWORD,
        mongodb_host=MONGODB_HOST,
        mongodb_port=MONGODB_PORT,
        database_name = DATABASE_NAME,
        collection_name = COLLECTION_NAME,
        username = username,
        password_old = password_old,
        password_new = password_new
    )

    if result:
        print("Password updated successfully!")
        return True
    else:
        print("Old password is not correct!")
        return False

def verify_password(username,password):
    result = core.verify_password(
        mongodb_username=MONGODB_USER,
        mongodb_password=MONGODB_PASSWORD,
        mongodb_host=MONGODB_HOST,
        mongodb_port=MONGODB_PORT,
        database_name = DATABASE_NAME,
        collection_name = COLLECTION_NAME,
        username = username,
        password = password
    )

   if result:
        print("Password is correct!")
        return True
   else:
        print("Password is not correct!")
        return False

if __name__ == "__main__":
    save_password("test","test")
    # Username does not exist!
    # Password saved successfully!

    # update_password("test","test","test2")
    # Password updated successfully!

    # verify_password("test","test2")
    # Password is correct!

v0.0.2

  • update some bugs

v0.0.1

  • save password to mongodb , password is hashed
  • check password from mongodb , password is hashed
  • update password to mongodb , password is hashed

Metadata

Release files for master-auth 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for master-auth 0.0.2
File Size Uploaded Provenance Actions
master_auth-0.0.2.tar.gz 4.8 kB Without provenance Details for master_auth-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for master-auth 0.0.2
File Interpreter ABI Platform Actions
master_auth-0.0.2-py3-none-any.whl Python 3 none any Details for master_auth-0.0.2-py3-none-any.whl

Total release size: 9.0 kB

Release files / master_auth-0.0.2.tar.gz

Download URL master_auth-0.0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
380479140a595610f0ea6b0dca91c6dd3cf3da2c6d7a531c43665320a9bb69d4
BLAKE2b-256 checksum
How to use checksums
a96dea8a263ba8678b4a6a8fe9d11a481318c85c8f2a8367078b05e056392a66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / master_auth-0.0.2-py3-none-any.whl

Download URL master_auth-0.0.2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30bcdc450d5958505078bce0db4589879f073efad27e4e3c05bf2c843785fd66
BLAKE2b-256 checksum
How to use checksums
e39e30f992c3f2732adcb1cb4fb9db2a5752fb251e5d25a68c11f649022b0b65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for master-auth 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page