diff --git a/PythonLoginAndRegister.egg-info/PKG-INFO b/PythonLoginAndRegister.egg-info/PKG-INFO new file mode 100644 index 0000000..5ce464c --- /dev/null +++ b/PythonLoginAndRegister.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: PythonLoginAndRegister +Version: 0.1 +Summary: Basic Login and Registration in Python +Home-page: https://github.com/coolhobo77/Python-Login-And-Register +Author: coolhobo77 +Author-email: joshuaboddy1@gmail.com +License: MIT +Description: UNKNOWN +Platform: UNKNOWN diff --git a/PythonLoginAndRegister.egg-info/SOURCES.txt b/PythonLoginAndRegister.egg-info/SOURCES.txt new file mode 100644 index 0000000..b604745 --- /dev/null +++ b/PythonLoginAndRegister.egg-info/SOURCES.txt @@ -0,0 +1,7 @@ +setup.py +PythonLoginAndRegister.egg-info/PKG-INFO +PythonLoginAndRegister.egg-info/SOURCES.txt +PythonLoginAndRegister.egg-info/dependency_links.txt +PythonLoginAndRegister.egg-info/not-zip-safe +PythonLoginAndRegister.egg-info/top_level.txt +src/LogAndReg.py \ No newline at end of file diff --git a/PythonLoginAndRegister.egg-info/dependency_links.txt b/PythonLoginAndRegister.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/PythonLoginAndRegister.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/PythonLoginAndRegister.egg-info/not-zip-safe b/PythonLoginAndRegister.egg-info/not-zip-safe new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/PythonLoginAndRegister.egg-info/not-zip-safe @@ -0,0 +1 @@ + diff --git a/PythonLoginAndRegister.egg-info/top_level.txt b/PythonLoginAndRegister.egg-info/top_level.txt new file mode 100644 index 0000000..85de9cf --- /dev/null +++ b/PythonLoginAndRegister.egg-info/top_level.txt @@ -0,0 +1 @@ +src diff --git a/LogAndReg.py b/build/lib/src/LogAndReg.py similarity index 100% rename from LogAndReg.py rename to build/lib/src/LogAndReg.py diff --git a/dist/PythonLoginAndRegister-0.1-py2.py3-none-any.whl b/dist/PythonLoginAndRegister-0.1-py2.py3-none-any.whl new file mode 100644 index 0000000..387d9ac Binary files /dev/null and b/dist/PythonLoginAndRegister-0.1-py2.py3-none-any.whl differ diff --git a/dist/PythonLoginAndRegister-0.1.tar.gz b/dist/PythonLoginAndRegister-0.1.tar.gz new file mode 100644 index 0000000..7300b92 Binary files /dev/null and b/dist/PythonLoginAndRegister-0.1.tar.gz differ diff --git a/setup.py b/setup.py index 129d563..e29b88b 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,14 @@ -from setuptools import setup, find_packages -from codecs import open -from os import path +from setuptools import setup -here = path.abspath(path.dirname(__file__)) -with open(path.join(here, 'README.rst'), encoding='utf-8') as f: - long_description = f.read() -setup( - name='SimpleLoginAndRegister', - version='1.0.0', - description='A Basic Login and Registration System', - long_description=long_description, - url='https://github.com/coolhobo77/Python-Login-And-Register', - author='coolhobo77', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Authentication', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - ], - keywords='simple login register authenticate auth authentication', - packages=find_packages(py_modules=["Login.py"]), -) +setup(name='PythonLoginAndRegister', + version='0.1', + description='Basic Login and Registration in Python', + long_description=long_desc, + url='https://github.com/coolhobo77/Python-Login-And-Register', + author='coolhobo77', + author_email='joshuaboddy1@gmail.com', + license='MIT', + packages=['src'], + zip_safe=False) diff --git a/src/LogAndReg.py b/src/LogAndReg.py new file mode 100644 index 0000000..a826278 --- /dev/null +++ b/src/LogAndReg.py @@ -0,0 +1,117 @@ +#################################### +# Python Login Validation System # +# By coolhobo77 # +#################################### + +# This module aims to provide a clear layout for a login system based in Python +# This module is not over-complicated and very straightforward to use! +# This is a way for beginners to look into modules and see how they work + +# Defines an Array that Contains Every Instantiated User Class added +totalUsers = [] + +# User Class that Provides the Structure for a User Object +# This class is what is created on invoking the createUser() function +class User: + + # User Class Constructor, Defines Variable Names in a Global Reach within the Class Object + # Also appends the Object to the __totalUsers array on it's creation + def __init__(self, name, surname, email, password): + self.name = name + self.surname = surname + self.email = email + self.password = password + totalUsers.append(self) + + # Returns all info about a given user object + def getInfo(self): + print(self.name) + print(self.surname) + print(self.email) + print(self.password) + + # Returns the Name of a User + def getName(self): + return self.name + + # Returns the Surname of a User + def getSurname(self): + return self.surname + + # Returns the Email of a User + def getEmail(self): + return self.email + + # Returns the Password of a Certain User + def getPassword(self): + return self.password + +# Returns a new instantiation of the User Class for storage in a variable +# Instantiations can be accessed later by accessing the __totalUsers array +def createUser(name, surname, email, password): + return User(name, surname, email, password) + +# Returns a new instantiation of the User Class based off of user inputs +# Will return the User if the entries are valid, but will return False if they are not +def inputUser(nameEntry, surnameEntry, emailEntry, passwordEntry): + name = str(input(nameEntry + " : ")) + surname = str(input(surnameEntry + " : ")) + email = str(input(emailEntry + " : ")) + password = str(input(passwordEntry + " : ")) + if validateInputs(name, surname, email, password): + return createUser(name, surname, email, password) + else: + return False + +# Validates the password of a specific user against a preset password +# This will return if the password is valid and False if it is not +def validateUser(user, password): + if user.password == password: + return True + else: + return False + +#Lists all Users inside the totalUsers array without displaying passwords +def listUsers(): + safeUsers = [] + for user in totalUsers: + safeUsers.append({user.name, user.surname, user.email}) + return safeUsers + +# Lists all Users in the totalUsers array while displaying passwords +def unsafeList(): + print("This function should only be used by Admins!") + print("Make sure there are no other onlookers to this screen or it's output") + print("Confirmation is required before displaying this information") + conf = str(input("Are you sure you would like to display this information? (y/n)")) + if conf == "y": + for user in totalUsers: + print(user.name) + print(user.surname) + print(user.email) + print(user.password) + return True + else: + return False + +# Checks all the Users to see if a password and email match is found +# This will return True if a match is found, and False if not +def userExists(email, password): + for user in totalUsers: + if user.email == email and user.password == password: + return True + else: + return False + +# Removes a user based on their email as a primary key +# Uses a list comprehension to reassign the totalUsers array with a filter for the email +def removeUser(email): + count = 0 + indexStore = [] + while count < len(totalUsers): + if(totalUsers[count].email == email): + indexStore.append(count) + count += 1 + for index in indexStore: + del(totalUsers[index]) + return True