Created
April 28, 2018 17:37
-
-
Save oliverbth05/3e3a8f5ae00e1f8dba72fbf3b2f48b3c to your computer and use it in GitHub Desktop.
Password Generator (Vue + Semantic UI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#text-align-center{ | |
text-align: center; | |
} | |
#width170{ | |
width: 170px; | |
} | |
#width70{ | |
width: 70px; | |
} | |
#margin-equal{ | |
margin:auto; | |
} | |
#body{ | |
background: #141E30; /* fallback for old browsers */ | |
background: -webkit-linear-gradient(to right, #243B55, #141E30); /* Chrome 10-25, Safari 5.1-6 */ | |
background: linear-gradient(to right, #243B55, #141E30); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ | |
} | |
html *{ | |
font-family: 'Raleway', sans-serif; | |
} | |
#overflow-wrap{ | |
overflow-wrap: break-word; | |
} | |
#lighter-font{ | |
font-weight: lighter; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Vue({ | |
el: "#app", | |
data: { | |
rawEntry: '', | |
passwordGenerated: '' | |
}, | |
methods: { | |
generatePassword: function(){ | |
if(this.rawEntry == ''){ | |
alert("Invalid Character Length") | |
} | |
else{ | |
var password = ""; | |
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
for (var i = 0; i < this.passwordLength; i++){ | |
password += possible.charAt(Math.floor(Math.random() * possible.length)); | |
} | |
this.passwordGenerated = password; | |
} | |
} | |
}, | |
computed:{ | |
passwordLength: function(){ | |
return parseInt(this.rawEntry) | |
} | |
} | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel = "stylesheet" type = "text/css" href = "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/semantic.css"> | |
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet"> | |
<link rel = "stylesheet" type = "text/css" href = "app.css"> | |
</head> | |
<body id = "body"> | |
<div class = "ui container" id = "app"> | |
<div class = "ui segment" id = "text-align-center"> | |
<h1>Password Generator V1</h1> | |
</div> | |
<div class = "ui segment"> | |
<div class = "ui stackable grid"> | |
<div class = "eight wide column" id = "text-align-center"> | |
<h3 id = "text-align-center">Password Length</h1> | |
<div class="ui input" id = "width70"> | |
<input type="text" v-model = "rawEntry"> | |
</div> | |
<br> | |
<br> | |
<button @click = "generatePassword" class = "ui button" id = "width170">Generate Password</button> | |
</div> | |
<div class = "eight wide column" id = "text-align-center"> | |
<h3>Password:</h3> | |
<div class = "ui segment" id = "overflow-wrap"><h4 id = "lighter-font">{{passwordGenerated}}</h4></div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> | |
<script src = "app.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment