Finish up

This commit is contained in:
calzoneman 2013-05-30 14:34:54 -04:00
parent 5205afb9cd
commit 52b88c0e40
8 changed files with 124 additions and 70 deletions

14
api.js
View File

@ -366,6 +366,20 @@ function handleProfileChange(params, req, res) {
success: result, success: result,
error: result ? "" : "Internal error. Contact an administrator" error: result ? "" : "Internal error. Contact an administrator"
}); });
for(var n in Server.channels) {
var chan = Server.channels[n];
for(var i = 0; i < chan.users.length; i++) {
if(chan.users[i].name.toLowerCase() == name) {
chan.users[i].profile = {
image: img,
text: text
};
chan.broadcastUserUpdate(chan.users[i]);
break;
}
}
}
} }
function handleEmailChange(params, req, res) { function handleEmailChange(params, req, res) {

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "1.9.2", "version": "1.9.3",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -26,8 +26,9 @@
<a class="brand" href="index.html">CyTube</a> <a class="brand" href="index.html">CyTube</a>
<div class=""> <div class="">
<ul class="nav"> <ul class="nav">
<li class="active"><a href="index.html">Home</a></li> <li><a href="index.html">Home</a></li>
<li><a href="help.html">Help</a></li> <li><a href="help.html">Help</a></li>
<li class="active"><a href="account.html">Account</a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -48,6 +49,9 @@
<li><a href="javascript:void(0)" id="email">Change Email</a></li> <li><a href="javascript:void(0)" id="email">Change Email</a></li>
</ul> </ul>
</div> </div>
<div class="span7">
<h3>Select an action from the sidebar</h3>
</div>
<div class="span7" id="registerpane" style="display: none"> <div class="span7" id="registerpane" style="display: none">
<h3>Register New Account</h3> <h3>Register New Account</h3>
<form class="form-horizontal" action="javascript:void(0)"> <form class="form-horizontal" action="javascript:void(0)">

View File

@ -1067,14 +1067,11 @@ function showUserOpts() {
sendbtn.prop("checked", USEROPTS.chatbtn); sendbtn.prop("checked", USEROPTS.chatbtn);
addOption("Send Button", sendbtncontainer); addOption("Send Button", sendbtncontainer);
var profimg = $("<input/>").attr("type", "text") var profile = $("<a/>").attr("target", "_blank")
profimg.val(PROFILE.image); .addClass("btn")
addOption("Profile Image", profimg); .attr("href", "./account.html")
.text("Profile has moved to the account page");
var profbio = $("<textarea/>"); addOption("Profile", profile);
profbio.attr("rows", 5);
profbio.val(PROFILE.text);
addOption("Profile Text", profbio);
if(RANK >= Rank.Moderator) { if(RANK >= Rank.Moderator) {
$("<hr>").appendTo(form); $("<hr>").appendTo(form);
@ -1091,10 +1088,6 @@ function showUserOpts() {
.appendTo(footer); .appendTo(footer);
submit.click(function() { submit.click(function() {
socket.emit("setProfile", {
image: profimg.val(),
text: profbio.val()
});
USEROPTS.theme = themeselect.val(); USEROPTS.theme = themeselect.val();
USEROPTS.css = usercss.val(); USEROPTS.css = usercss.val();
USEROPTS.layout = layoutselect.val(); USEROPTS.layout = layoutselect.val();

View File

@ -28,6 +28,7 @@
<ul class="nav"> <ul class="nav">
<li class="active"><a href="index.html">Home</a></li> <li class="active"><a href="index.html">Home</a></li>
<li><a href="help.html">Help</a></li> <li><a href="help.html">Help</a></li>
<li><a href="account.html">Account</a></li>
<li><a href="javascript:void(0)" id="optlink">Options</a></li> <li><a href="javascript:void(0)" id="optlink">Options</a></li>
</ul> </ul>
<div class="navbar-form pull-right" id="loginform"> <div class="navbar-form pull-right" id="loginform">

View File

@ -32,6 +32,7 @@
<ul class="nav"> <ul class="nav">
<li class="active"><a href="index.html">Home</a></li> <li class="active"><a href="index.html">Home</a></li>
<li><a href="help.html">Help</a></li> <li><a href="help.html">Help</a></li>
<li><a href="account.html">Account</a></li>
<li><a href="javascript:void(0)" id="optlink">Options</a></li> <li><a href="javascript:void(0)" id="optlink">Options</a></li>
</ul> </ul>
</div> </div>

View File

@ -8,11 +8,8 @@
#username, #pw { #username, #pw {
width: 95%; width: 95%;
} }
#login, #register { .btn {
width: 49%; width: 45%;
}
#changepass {
width: 99%;
} }
</style> </style>
</head> </head>
@ -30,27 +27,10 @@
<input type="password" id="pw"> <input type="password" id="pw">
</div> </div>
</div> </div>
<div class="control-group" style="display: none" id="newpassdiv">
<label class="control-label" for="newpass" id="nplabel">New Password</label>
<div class="controls">
<input type="password" id="newpass">
</div>
</div>
<div class="control-group" style="display: none" id="pw2div">
<label class="control-label" for="pw2" id="confirm">Confirm Password</label>
<div class="controls">
<input type="password" id="pw2">
</div>
</div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<button class="btn" id="login">Login</button> <button class="btn" id="login">Login</button>
<button class="btn" id="register">Register</button> <a class="btn" id="register" target="_blank" href="account.html">Register</a>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn" id="changepass">Change Password</button>
</div> </div>
</div> </div>
</form> </form>
@ -91,39 +71,6 @@
source.postMessage("cytube-login:"+JSON.stringify(data), document.location); source.postMessage("cytube-login:"+JSON.stringify(data), document.location);
}); });
}); });
$("#register").click(function() {
if($("#pw2div").css("display") == "none") {
$("#pw2div").css("display", "");
return false;
}
else if($("#pw2").val() != $("#pw").val()) {
$("#confirm").addClass("text-error");
return;
}
$.getJSON(WEB_URL+"/api/json/register?name="+$("#username").val()+"&pw="+$("#pw").val()+"&callback=?", function(data) {
console.log(data);
data.uname = $("#username").val();
source.postMessage("cytube-login:"+JSON.stringify(data), document.location);
});
});
$("#changepass").click(function() {
if($("#newpassdiv").css("display") == "none") {
$("#newpassdiv").css("display", "");
$("#pw2div").css("display", "");
return false;
}
else if($("#newpass").val() != $("#pw2").val()) {
$("#confirm").addClass("text-error");
return;
}
$.getJSON(WEB_URL+"/api/json/changepass?name="+$("#username").val()+"&oldpw="+$("#pw").val()+"&newpw="+$("#newpass").val()+"&callback=?", function(data) {
if(data.success) {
$("#newpassdiv").css("display", "none");
$("#pw2div").css("display", "none");
}
source.postMessage("cytube-changepass:"+JSON.stringify(data), document.location);
});
});
</script> </script>
</body> </body>
</html> </html>

94
www/reset.html Normal file
View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CyTube</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Calvin 'calzoneman' Montgomery">
<link href="./assets/css/bootstrap.css" rel="stylesheet">
<link href="./assets/css/ytsync.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
<link href="./assets/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="wrapper">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="index.html">CyTube</a>
<div class="">
<ul class="nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="help.html">Help</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span12">
<h3>Account Recovery</h3>
</div>
</div>
</div> <!-- /container -->
<div class="push"></div>
<div id="sitefooter">
</div>
</div>
<div id="footer">
<p class="muted">
CyTube Software Copyright &copy; 2013 Calvin Montgomery&nbsp;&middot;&nbsp;Available for free on <a href="http://github.com/calzoneman/sync">GitHub</a>&nbsp;&middot;
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5Y7PUVVGVSEWG&lc=US&item_name=CyTube&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted">Donate</a>
</p>
</div>
<!-- Third party -->
<script src="./assets/js/jquery.js"></script>
<script src="./assets/js/bootstrap.js"></script>
<script src="./assets/js/bootstrap-transition.js"></script>
<script src="./assets/js/bootstrap-modal.js"></script>
<!-- Mine -->
<script src="./assets/js/iourl.js"></script>
<script type="text/javascript">
var hash = false;
(function() {
var loc = document.location+"";
if(loc.indexOf("?") == -1) {
return;
}
hash = loc.substring(loc.indexOf("?") + 1);
})();
var url = WEB_URL+"/api/json/recoverpw?hash="+hash+"&callback=?";
$.getJSON(url, function(data) {
if(data.success) {
$("<div/>").addClass("alert alert-success")
.html([
"Password Reset.<br><strong>Username: </strong>",
data.name,
"<br><strong>Password: </strong>",
data.pw,
" (change this immediately for security)"].join(""))
.appendTo($(".span12")[0]);
}
else {
$("<div/>").addClass("alert alert-error")
.text(data.error)
.appendTo($(".span12")[0]);
}
});
</script>
</body>
</html>