diff --git a/index.html b/index.html new file mode 100644 index 0000000..629c38f --- /dev/null +++ b/index.html @@ -0,0 +1,69 @@ + + + + + + Générateur de MDP + + + +
+
+ + +
+ Générateur de mot de passe +
+ + +
+ Paramètres : +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/scripts/main.js b/scripts/main.js new file mode 100644 index 0000000..4ca56f8 --- /dev/null +++ b/scripts/main.js @@ -0,0 +1,26 @@ +function generatePassword(nbDigits, caps, numbers, specials) { + var resultat = "" + + for (let i = 0; i < nbDigits ; i++) { + resultat += generateCharacter(caps, numbers, specials) + } + + return resultat +} + +function generateCharacter(caps, numbers, specials) { + var LETTERS_TABLE = "abcdefghijklmnopqrstuvwxyz" + var CAPS_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + var NUMBERS_TABLE = "0123456789" + var SPECIALS_TABLE = "!#$%&'()*+,-./:;=?@[]^_`{|}~"; + + var resultat = LETTERS_TABLE + + if (caps) resultat += CAPS_TABLE + if (numbers) resultat += NUMBERS_TABLE + if (specials) resultat += SPECIALS_TABLE + + var randomNumber = Math.floor(Math.random() * resultat.length) + + return resultat.charAt(randomNumber) +} \ No newline at end of file diff --git a/styles/style.css b/styles/style.css new file mode 100644 index 0000000..e7eebfb --- /dev/null +++ b/styles/style.css @@ -0,0 +1,38 @@ +body { + margin: 0; + padding: 0; + width: 100%; + height: 100vh; + + background-color: #2c3e50; + color: #ecf0f1; +} + +.container { + text-align: center; + height: 100%; + display: grid; +} + +.card { + width: 500px; + height: 700px; + + margin: auto; + padding: 25px; + + background-color: #34495e; + border-radius: 10px; +} + +#password { + background-color: #2c3e50; + padding: 0 10px; + font-size: 2em; + border-radius: 10px; + font-family : consolas +} + +fieldset div { + text-align: left; +} \ No newline at end of file