Merge branch 'master' of https://github.com/coolhobo77/Python-Login-And-Register
This commit is contained in:
commit
b68fd3adaf
1 file changed
+98
-2
@@ -3,8 +3,8 @@ Basic Login and Registration System to be Used by New Developers to Structure th
|
||||
|
||||
## Contents
|
||||
* Introduction
|
||||
* How to Use
|
||||
* Documentation
|
||||
* Examples
|
||||
* Installation
|
||||
|
||||
## Introduction
|
||||
@@ -69,4 +69,100 @@ A user can be checked to see if their object exists using the following function
|
||||
userExists("EMAIL", "PASSWORD")
|
||||
```
|
||||
|
||||
This function will return True or False respectively depending on the value.
|
||||
This function will return True or False respectively depending on the value. This is a search through the whole array for a specific user to see if they exist or not and could be used to validate logins, however a second check should be run to make sure this is not a form of bruteforcing
|
||||
|
||||
#### Validate User
|
||||
A User can be validated at any point in the code quite easily to see if their password matches a prescribed standard password that the developer invokes.
|
||||
|
||||
```python
|
||||
# Validate an Existing User
|
||||
validateUser(UserObject, "PASSWORD")
|
||||
```
|
||||
|
||||
Unlike User Eistance, User Validation uses a preset password and only requires the single user object to validate. This means that the system does not have to browse an entire array for a user to validate, when the user information is stored on a local object
|
||||
|
||||
### User Removal
|
||||
A user can simply be removed from an array by calling the following function with their email as the parameter :
|
||||
|
||||
```python
|
||||
# Remove a Specific User
|
||||
removeUser("EMAIL")
|
||||
```
|
||||
|
||||
## Examples
|
||||
The following examples can be used to show basic functionality of the system
|
||||
|
||||
### Basic Login
|
||||
|
||||
```python
|
||||
email = str(input("Enter Your Email : "))
|
||||
password = str(input("Enter Your Password : "))
|
||||
|
||||
if userExists(email, password):
|
||||
print("Welcome!")
|
||||
else:
|
||||
print("Sorry, Invalid Credentials!")
|
||||
```
|
||||
|
||||
### Basic Registration (Without Registration Function)
|
||||
|
||||
```python
|
||||
name = str(input("Enter Your Name : "))
|
||||
surname = str(input("Enter Your Surname : "))
|
||||
email = str(input("Enter Your Email : "))
|
||||
password = str(input("Enter Your Password : "))
|
||||
confPassword = str(input("Confirm Your Password : "))
|
||||
|
||||
if(password == confPassword):
|
||||
print("User Accepted!")
|
||||
user = createUser(name, surname, email, password)
|
||||
else:
|
||||
print("User Rejected! Invalid Password Combination")
|
||||
```
|
||||
|
||||
_Conditionals can be used to create more validation methods, functions are planned to be implemented in the near future_
|
||||
|
||||
### Basic Registration (With Registration Function)
|
||||
|
||||
```python
|
||||
user = inputUser("Enter Your First Name : ", "Enter Your Surname : ", "Enter Your Email : ", "Enter Your Intended Password : ")
|
||||
```
|
||||
|
||||
### Stored Password Check
|
||||
|
||||
```python
|
||||
user = createUser("Josh", "Jameson", "joshywashy1@spaceymail.com", "MIDAS")
|
||||
adminPassword = "MIDAS"
|
||||
|
||||
if validateUser(user, adminPassword):
|
||||
print("You have Admin Access!")
|
||||
else:
|
||||
print("You Don't Have Admin Access!")
|
||||
```
|
||||
|
||||
_Please don't use this code, it's very insecure and any user that sets their password as MIDAS will have admin access!_
|
||||
_Demonstration Purposes Only!_
|
||||
|
||||
### Remove a User fro the System
|
||||
|
||||
```python
|
||||
user = createUser("Josh", "Jameson", "joshywashy1@spaceymail.com", "MIDAS")
|
||||
|
||||
if !validateUser(user, "ZEUS"):
|
||||
removeUser(user.email)
|
||||
else:
|
||||
print("Welcome!")
|
||||
```
|
||||
|
||||
## Installation
|
||||
Python setup.py installation :
|
||||
|
||||
```bash
|
||||
python setup.py install
|
||||
```
|
||||
|
||||
or use pip :
|
||||
|
||||
```bash
|
||||
pip install PythonLoginAndRegister
|
||||
```
|
||||
Reference in new issue
Block a user