Skip to content

Commit

Permalink
Merge pull request #7 from fawazsullia/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
fawazsullia committed Jan 17, 2023
2 parents d411a51 + 5a5d2fb commit cec1adb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Passwordinator
### Generate random passwords of varying complexity

Note : This was a fun project I did when learning. This is not ideal way to generate random passwords and should not be used in any serious applications.
Also, since heroku is down, you might not be able to access the endpoint.

## About

Passwordinator is an API that lets you generate random passwords of varying complexity in your app/website.
The api is free and can be accessed at any origin.

## How to access

Passwordinator lives at https://passwordinator.herokuapp.com
Passwordinator lives at https://passwordinator.onrender.com

End point gives you access to a 14 character long password made of small case alphabets.

Expand All @@ -20,7 +23,7 @@ Available queries
- ?num=true ( adds number to the password )
- ?char=true (adds special character to the password )
- ?caps=true ( adds uppercase alphabets to the password )
- ?len=18 ( generates a 18 character password )
- ?len=18 ( generates a 18 character password . Must be greater than 7. Default is 12)


## Response format
Expand All @@ -38,7 +41,7 @@ The API returns a response in json format;



`fetch('https://passwordinator.herokuapp.com?num=true&char=true&caps=true&len=18')`
`fetch('https://passwordinator.onrender.com?num=true&char=true&caps=true&len=18')`
On resolving generates a 18 digit password with characters, alphabets, uppercase letters and numbers

I will slowly refine the doc. Watchout for new features!
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ const server = http.createServer((req, res) => {
"Access-Control-Allow-Methods": "GET",
"Content-Type": "application/json",
};

if(queryObj && queryObj.len && queryObj.num < 8){
res.writeHead(400, headers);
res.end(JSON.stringify({ data: `len can't be less than 8` }));
}
if (validity.state === false) {
res.writeHead(400, headers);
res.end(JSON.stringify({ data: `${validity.key} is not a valid query` }));
Expand Down

0 comments on commit cec1adb

Please sign in to comment.