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,
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) {

View File

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

View File

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

View File

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

View File

@ -28,6 +28,7 @@
<ul class="nav">
<li class="active"><a href="index.html">Home</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>
</ul>
<div class="navbar-form pull-right" id="loginform">

View File

@ -32,6 +32,7 @@
<ul class="nav">
<li class="active"><a href="index.html">Home</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>
</ul>
</div>

View File

@ -8,11 +8,8 @@
#username, #pw {
width: 95%;
}
#login, #register {
width: 49%;
}
#changepass {
width: 99%;
.btn {
width: 45%;
}
</style>
</head>
@ -30,27 +27,10 @@
<input type="password" id="pw">
</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="controls">
<button class="btn" id="login">Login</button>
<button class="btn" id="register">Register</button>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn" id="changepass">Change Password</button>
<a class="btn" id="register" target="_blank" href="account.html">Register</a>
</div>
</div>
</form>
@ -91,39 +71,6 @@
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>
</body>
</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>