aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar Renard 2019-09-27 12:55:20 -0300
committerLibravatar Renard 2019-09-27 12:55:20 -0300
commit1ce71de003d02f1b1c0e4a6ddd65cdb087d594c3 (patch)
treedbc9e03c77e4482d2ac1cd417b3486252b358f96 /src
parent522b92fbf7d2f79f6fe5dd9395c3175f8161053d (diff)
downloadbai-client-1ce71de003d02f1b1c0e4a6ddd65cdb087d594c3.tar.gz
bai-client-1ce71de003d02f1b1c0e4a6ddd65cdb087d594c3.tar.xz
bai-client-1ce71de003d02f1b1c0e4a6ddd65cdb087d594c3.zip
Añadido: Generación de contraseña para posts
Diffstat (limited to 'src')
-rw-r--r--src/App.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/App.js b/src/App.js
index c61ba33..4237784 100644
--- a/src/App.js
+++ b/src/App.js
@@ -60,6 +60,29 @@ class App extends Component {
} else {
this.setState({ nightMode: JSON.parse(_nightMode) });
}
+ let password = localStorage.getItem("password");
+ if (password === null) {
+ localStorage.setItem("password", this.genPassword());
+ }
+ }
+
+ genPassword() {
+ let pass = "";
+ for (let i = 0; i < 10; i++) {
+ let x = Math.round(Math.random() * 2);
+ switch (x) {
+ case 0:
+ pass += String.fromCharCode(48 + Math.round(Math.random() * 9));
+ break;
+ case 1:
+ pass += String.fromCharCode(65 + Math.round(Math.random() * 25));
+ break;
+ case 2:
+ pass += String.fromCharCode(97 + Math.round(Math.random() * 25));
+ break;
+ }
+ }
+ return pass;
}
componentDidUpdate() {