This commit is contained in:
calzoneman 2014-03-01 17:37:59 -06:00
parent b96b488c22
commit 341d17c7b9
6 changed files with 22 additions and 14 deletions

View File

@ -909,7 +909,8 @@ Channel.prototype.banIP = function (actor, ip, name, reason, range) {
} }
self.logger.log("[mod] " + actor.name + " banned " + ip + " (" + name + ")"); self.logger.log("[mod] " + actor.name + " banned " + ip + " (" + name + ")");
self.sendModMessage(actor.name + " banned " + ip + " (" + name + ")", self.permissions.ban); self.sendModMessage(actor.name + " banned " + util.maskIP(ip) +
" (" + name + ")", self.permissions.ban);
// If in the channel already, kick the banned user // If in the channel already, kick the banned user
for (var i = 0; i < self.users.length; i++) { for (var i = 0; i < self.users.length; i++) {
if (self.users[i].ip === ip) { if (self.users[i].ip === ip) {
@ -3034,7 +3035,8 @@ Channel.prototype.handleSetRank = function (user, data) {
var name = data.user.substring(0, 20); var name = data.user.substring(0, 20);
var rank = data.rank; var rank = data.rank;
if (isNaN(rank) || rank < 1 || rank >= user.rank) { if (isNaN(rank) || rank < 1 || (rank >= user.rank && !(user.rank === 4 &&
rank === 4))) {
user.socket.emit("channelRankFail", { user.socket.emit("channelRankFail", {
msg: "Updating user rank failed: You can't promote someone to equal or " + msg: "Updating user rank failed: You can't promote someone to equal or " +
"higher rank than yourself, or demote them below rank 1." "higher rank than yourself, or demote them below rank 1."
@ -3064,7 +3066,7 @@ Channel.prototype.handleSetRank = function (user, data) {
return; return;
} }
if (oldrank >= user.rank) { if (oldrank >= user.rank && !(oldrank === 4 && user.rank === 4)) {
user.socket.emit("channelRankFail", { user.socket.emit("channelRankFail", {
msg: "Updating user rank failed: " + name + " has equal or higher " + msg: "Updating user rank failed: " + name + " has equal or higher " +
"rank than you" "rank than you"
@ -3100,7 +3102,8 @@ Channel.prototype.handleSetRank = function (user, data) {
}; };
if (receiver) { if (receiver) {
if (Math.max(receiver.rank, receiver.global_rank) > user.rank) { var receiverrank = Math.max(receiver.rank, receiver.global_rank);
if (receiverrank > user.rank && !(receiverrank === 4 && user.rank === 4)) {
user.socket.emit("channelRankFail", { user.socket.emit("channelRankFail", {
msg: "Updating user rank failed: " + receiver.name + " has higher rank "+ msg: "Updating user rank failed: " + receiver.name + " has higher rank "+
"than you." "than you."

View File

@ -146,6 +146,10 @@ function preprocessConfig(cfg) {
var root = cfg.http["root-domain"]; var root = cfg.http["root-domain"];
root = root.replace(/^\.*/, ""); root = root.replace(/^\.*/, "");
cfg.http["root-domain"] = root; cfg.http["root-domain"] = root;
if (root.indexOf(".") !== -1) {
root = "." + root;
}
cfg.http["root-domain-dotted"] = root;
// Setup nodemailer // Setup nodemailer
cfg.mail.nodemailer = nodemailer.createTransport( cfg.mail.nodemailer = nodemailer.createTransport(

View File

@ -611,14 +611,14 @@ function handlePasswordReset(req, res) {
Logger.errlog.log("mail fail: " + err); Logger.errlog.log("mail fail: " + err);
sendJade(res, "account-passwordreset", { sendJade(res, "account-passwordreset", {
reset: false, reset: false,
resetEmail: user.email, resetEmail: email,
resetErr: "Sending reset email failed. Please contact an " + resetErr: "Sending reset email failed. Please contact an " +
"administrator for assistance." "administrator for assistance."
}); });
} else { } else {
sendJade(res, "account-passwordreset", { sendJade(res, "account-passwordreset", {
reset: true, reset: true,
resetEmail: user.email, resetEmail: email,
resetErr: false resetErr: false
}); });
} }

View File

@ -42,14 +42,15 @@ function handleLogin(req, res) {
}); });
} else { } else {
var auth = user.name + ":" + user.hash; var auth = user.name + ":" + user.hash;
console.log(Config.get("http.root-domain-dotted"));
res.cookie("auth", auth, { res.cookie("auth", auth, {
domain: "." + Config.get("http.root-domain"), domain: Config.get("http.root-domain-dotted"),
expires: new Date(Date.now() + 7*24*60*60*1000), expires: new Date(Date.now() + 7*24*60*60*1000),
httpOnly: true httpOnly: true
}); });
res.cookie("rank", user.global_rank, { res.cookie("rank", user.global_rank, {
domain: "." + Config.get("http.root-domain"), domain: Config.get("http.root-domain-dotted"),
expires: new Date(Date.now() + 7*24*60*60*1000), expires: new Date(Date.now() + 7*24*60*60*1000),
}); });
@ -140,8 +141,8 @@ function handleShimLogout(req, res) {
res.clearCookie("auth"); res.clearCookie("auth");
res.clearCookie("rank"); res.clearCookie("rank");
res.clearCookie("auth", { domain: "." + Config.get("http.root-domain") }); res.clearCookie("auth", { domain: Config.get("http.root-domain-dotted") });
res.clearCookie("rank", { domain: "." + Config.get("http.root-domain") }); res.clearCookie("rank", { domain: Config.get("http.root-domain-dotted") });
if (redirect.match(/login|logout/)) { if (redirect.match(/login|logout/)) {
@ -198,8 +199,8 @@ function handleLogout(req, res) {
var host = req.host; var host = req.host;
if (host.indexOf(Config.get("http.root-domain")) !== -1) { if (host.indexOf(Config.get("http.root-domain")) !== -1) {
res.clearCookie("auth", { domain: Config.get("http.root-domain") }); res.clearCookie("auth", { domain: Config.get("http.root-domain-dotted") });
res.clearCookie("rank", { domain: Config.get("http.root-domain") }); res.clearCookie("rank", { domain: Config.get("http.root-domain-dotted") });
} else { } else {
var dest = Config.get("http.full-address") + "/shimlogout?redirect=" + var dest = Config.get("http.full-address") + "/shimlogout?redirect=" +
encodeURIComponent(ref); encodeURIComponent(ref);

View File

@ -58,7 +58,7 @@
border-top-right-radius: 0; border-top-right-radius: 0;
} }
.linewrap { .linewrap, .linewrap code {
white-space: pre-wrap; /* css-3 */ white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */ white-space: -pre-wrap; /* Opera 4-6 */

View File

@ -1939,7 +1939,7 @@ function formatCSModList() {
.attr("data-toggle", "dropdown") .attr("data-toggle", "dropdown")
.html("Edit <span class=caret></span>") .html("Edit <span class=caret></span>")
.appendTo(dd); .appendTo(dd);
if (CLIENT.rank <= entry.rank) { if (CLIENT.rank <= entry.rank && !(CLIENT.rank === 4 && entry.rank === 4)) {
toggle.addClass("disabled"); toggle.addClass("disabled");
} }