Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

password generator added #241

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions React-Password-Generator-master/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import { Client as Styletron } from 'styletron-engine-atomic';
import { Provider as StyletronProvider } from 'styletron-react';
import Nav from "./nav/Nav";
import Main from "./main/Main";
const engine = new Styletron();

const App = () => {
return (
<StyletronProvider value={engine} style={{ width: '100%' }}>
<Nav />
<Main />
</StyletronProvider>
);
};

export default App;
46 changes: 46 additions & 0 deletions React-Password-Generator-master/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# React-Password-Generator

## Video Demo

[![Video Demo](https://www.youtube.com/watch?v=WEU9jhG0hSE/0.jpg)](https://www.youtube.com/watch?v=WEU9jhG0hSE)

## Tech Stack

- React
- HTML
- CSS
- JavaScript
- Parcel-bundler
- Base UI

## Cloning the Repository

Clone the repository using the command below:

```bash
git clone https://github.com/Kritika30032002/ReactCreations.git
```

Move into the directory where we have the project files:

```bash
cd ReactCreations\React-Password-Generator>
```

## How to use?

* Install dependencies
```bash
npm install
```

* Start development server
```bash
npm run dev
```

* Build for production (output in dist folder)
```bash
npm run build
```
⚠ Then, the development server will be started at http://127.0.0.1:5173/
27 changes: 27 additions & 0 deletions React-Password-Generator-master/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<style>
body {
margin: 0px;
background-color: #fff;
overflow-x: hidden;
}
</style>
<link
rel="stylesheet"
href="https://cdn.rawgit.com/mfd/09b70eb47474836f25a21660282ce0fd/raw/e06a670afcb2b861ed2ac4a1ef752d062ef6b46b/Gilroy.css"
/>
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
/>

<title>React Password Generator</title>
</head>
<body>
<div id="root"></div>
<script src="index.js"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions React-Password-Generator-master/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App.js";
import "@babel/polyfill";

ReactDOM.render(<App />, document.getElementById("root"));
39 changes: 39 additions & 0 deletions React-Password-Generator-master/main/Main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.left {
margin: 20px;
width: 40%;
border: 1px solid lightgrey;
}

.box {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
min-height: 200px;
padding: 20px;
border: 1px solid #ccc;
}

.right {
margin: 20px;
width: 40%;
}

.container {
width: 60%;
margin: 0px auto;
border: 1px solid #ccc;
overflow-x: hidden;
}

.result {
width: 60%;
margin: 20px auto;
color: "blue";
}

@media (min-width: 320px) and (max-width: 480px) {
.container {
width: 90%;
}
}
106 changes: 106 additions & 0 deletions React-Password-Generator-master/main/Main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React, { useState, useEffect } from "react";
import { Slider } from "baseui/slider";
import { Button, SHAPE } from "baseui/button";
import generator from "generate-password";
import { Checkbox, LABEL_PLACEMENT } from "baseui/checkbox";
import "./main.css";

const Main = () => {
const [value, setValue] = useState([10]);
const [numbers, setNumbers] = useState(true);
const [symbols, setSymbols] = useState(false);
const [lower, setLower] = useState(false);
const [upper, setUpper] = useState(false);
const [similar, setSimilar] = useState(false);
const [showResults, setShowResults] = useState(false);
const [results, setResults] = useState("");

const generate = () => {
if (symbols || lower || upper || numbers) {
var password = generator.generate({
length: value,
numbers: numbers,
uppercase: upper,
lowercase: lower,
symbols: symbols,
excludeSimilarCharacters: similar,
});
setResults(password);
setShowResults(true);
} else {
alert("Tick atleast one from numbers, symbols, uppercase & lowercase");
}
};

return (
<div className="container">
<h1
style={{
fontSize: 24,
textAlign: "center",
}}>
Select the length of Password
</h1>
<Slider
value={value}
max={20}
onChange={({ value }) => value && setValue(value)}
onFinalChange={({ value }) => console.log(value)}
/>
<div className="box">
<Checkbox
checked={numbers}
onChange={(e) => setNumbers((prev) => !prev)}
labelPlacement={LABEL_PLACEMENT.right}>
include numbers
</Checkbox>
<Checkbox
checked={symbols}
onChange={(e) => setSymbols((prev) => !prev)}
labelPlacement={LABEL_PLACEMENT.right}>
include symbols
</Checkbox>
<Checkbox
checked={lower}
onChange={(e) => setLower((prev) => !prev)}
labelPlacement={LABEL_PLACEMENT.right}>
include lowercase
</Checkbox>
<Checkbox
checked={upper}
onChange={(e) => setUpper((prev) => !prev)}
labelPlacement={LABEL_PLACEMENT.right}>
include uppercase
</Checkbox>
<Checkbox
checked={similar}
onChange={(e) => setSimilar((prev) => !prev)}
labelPlacement={LABEL_PLACEMENT.right}>
exclude similar characters
</Checkbox>
</div>
<div
style={{
display: "flex",
justifyContent: "center",
width: "100%",
}}>
<Button
style={{ margin: 20, width: "50%", backgroundColor: "#011A31" }}
onClick={() => generate()}
shape={SHAPE.pill}>
Generate
</Button>
</div>
<div className="result">
{showResults ? (
<p style={{ textAlign: "center", fontSize: 20, width: "100%" }}>
{results}
</p>
) : null}
</div>
</div>
);
};

export default Main;
14 changes: 14 additions & 0 deletions React-Password-Generator-master/nav/Nav.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.header {
padding: 0px;
min-height: 300px;
color: white;
text-align: center;
width: 100%;
overflow-x: hidden;
}

@media (min-width: 320px) and (max-width: 480px) {
.header {
min-height: 250px;
}
}
22 changes: 22 additions & 0 deletions React-Password-Generator-master/nav/Nav.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import svg from "../wave.svg";
import "./Nav.css";
const Nav = () => {
return (
<div
className="header"
style={{
backgroundImage: `url(${svg})`,
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
backgroundPosition: "center",
}}>
<h1 style={{ fontSize: 24, textAlign: "center" }}>
React Password Generator
</h1>
<p>Simple tool to generate strong passwords</p>
</div>
);
};

export default Nav;
1 change: 1 addition & 0 deletions React-Password-Generator-master/wave.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.