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.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
for (var i = 0; i < self.users.length; i++) {
if (self.users[i].ip === ip) {
@ -3034,7 +3035,8 @@ Channel.prototype.handleSetRank = function (user, data) {
var name = data.user.substring(0, 20);
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", {
msg: "Updating user rank failed: You can't promote someone to equal or " +
"higher rank than yourself, or demote them below rank 1."
@ -3064,7 +3066,7 @@ Channel.prototype.handleSetRank = function (user, data) {
return;
}
if (oldrank >= user.rank) {
if (oldrank >= user.rank && !(oldrank === 4 && user.rank === 4)) {
user.socket.emit("channelRankFail", {
msg: "Updating user rank failed: " + name + " has equal or higher " +
"rank than you"
@ -3100,7 +3102,8 @@ Channel.prototype.handleSetRank = function (user, data) {
};
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", {
msg: "Updating user rank failed: " + receiver.name + " has higher rank "+
"than you."

View File

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

View File

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

View File

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

View File

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

View File

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