Making the passwords more safe

This commit is contained in:
Kasper Rynning-Tønnesen
2015-05-14 16:15:35 +02:00
parent a84fe0577d
commit 545571f8c8
3 changed files with 10 additions and 4 deletions

View File

@@ -56,6 +56,7 @@
<script type="text/javascript" src="static/js/lib/jquery-ui-1.10.3.min.js"></script>--> <script type="text/javascript" src="static/js/lib/jquery-ui-1.10.3.min.js"></script>-->
<script src="//cdn.socket.io/socket.io-1.2.0.js"></script> <script src="//cdn.socket.io/socket.io-1.2.0.js"></script>
<script type="text/javascript" src="static/js/lib/iscroll-min.js"></script> <script type="text/javascript" src="static/js/lib/iscroll-min.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha256.js"></script>
<script> <script>
var socket = io.connect('http://'+window.location.hostname+':3000'); var socket = io.connect('http://'+window.location.hostname+':3000');
var guid = "<?php echo $guid; ?>"; var guid = "<?php echo $guid; ?>";

View File

@@ -14,6 +14,9 @@ socket.on("toast", function(msg)
break; break;
case "wrongpass": case "wrongpass":
msg=rnd(["That's not the right password!", "Wrong! Better luck next time...", "You seem to have mistyped the password", "Incorrect. Have you tried meditating?","Nope, wrong password!", "Wrong password. The authorities have been notified."]) msg=rnd(["That's not the right password!", "Wrong! Better luck next time...", "You seem to have mistyped the password", "Incorrect. Have you tried meditating?","Nope, wrong password!", "Wrong password. The authorities have been notified."])
if(localStorage[chan.toLowerCase()]){
localStorage.removeItem(chan.toLowerCase());
}
break; break;
case "shuffled": case "shuffled":
msg=rnd(["I vigorously stirred your playlist!", "I hope you like your list stirred, not shaken.", "I shuffled your playlist with the cosmic background radiation as a seed. Enjoy.", "100% randomized, for your listening pleasure!", "I hope you enjoy your fresh playlist!"]) msg=rnd(["I vigorously stirred your playlist!", "I hope you like your list stirred, not shaken.", "I shuffled your playlist with the cosmic background radiation as a seed. Enjoy.", "100% randomized, for your listening pleasure!", "I hope you enjoy your fresh playlist!"])
@@ -75,12 +78,13 @@ $('input[class=conf]').change(function()
function pass_save() function pass_save()
{ {
socket.emit('password', [document.getElementById("password").value, chan.toLowerCase(), guid]);
socket.emit('password', [CryptoJS.SHA256(document.getElementById("password").value).toString(), chan.toLowerCase(), guid]);
} }
function log_out(){ function log_out(){
if(localStorage[chan.toLowerCase()]){ if(localStorage[chan.toLowerCase()]){
localStorage.removeItem(chan.toLowerCase()) localStorage.removeItem(chan.toLowerCase());
w_p = true; w_p = true;
names=["vote","addsongs","longsongs","frontpage", "allvideos", "removeplay", "skip", "shuffle"]; names=["vote","addsongs","longsongs","frontpage", "allvideos", "removeplay", "skip", "shuffle"];
for (var i = 0; i < names.length; i++) { for (var i = 0; i < names.length; i++) {

View File

@@ -104,7 +104,8 @@ $(document).ready(function()
if(localStorage[chan.toLowerCase()]) if(localStorage[chan.toLowerCase()])
{ {
socket.emit("password", [localStorage[chan.toLowerCase()], chan.toLowerCase(), guid]); localStorage.removeItem(chan.toLowerCase());
//socket.emit("password", [localStorage[chan.toLowerCase()], chan.toLowerCase(), guid]);
} }
if($("#chan").html().toLowerCase() == "jazz") if($("#chan").html().toLowerCase() == "jazz")