CookiePrefix setting implemented

main
Inga 🏳‍🌈 14 years ago
parent da963bc3e7
commit 4b53cec9be
  1. 2
      Builder/IISMainHandler/build.txt
  2. 3
      Common/Config.cs
  3. 4
      Common/dataobjects/Account.cs
  4. 4
      IISMainHandler/WebContext.cs
  5. 2
      IISMainHandler/handlers/request/LoginHandler.cs
  6. 3
      IISMainHandler/handlers/request/LogoutHandler.cs

@ -37,6 +37,8 @@ namespace FLocal.Common {
public readonly HashSet<string> AdditionalHosts;
public readonly string CookiesPrefix;
public readonly int MinPostId;
protected Config(NameValueCollection data) : base(data) {
@ -54,6 +56,7 @@ namespace FLocal.Common {
this.IsMigrationEnabled = parseBool(data["EnableMigration"]);
this.BaseHost = data["BaseHost"];
this.AdditionalHosts = new HashSet<string>(from host in data["AdditionalHosts"].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) select host.Trim());
this.CookiesPrefix = data["CookiesPrefix"];
this.MinPostId = int.Parse(data["MinPostId"]);
}

@ -135,11 +135,11 @@ namespace FLocal.Common.dataobjects {
}
private string hashPasswordLegacy(string password) {
return Util.md5(Util.md5(password) + " " + Util.md5(Config.instance.SaltMigration) + " " + Util.md5(this.id.ToString()));
return Util.md5(Util.md5(password) + " " + Util.md5(Config.instance.SaltPasswords) + " " + Util.md5(this.id.ToString()));
}
private static string hashPassword(string password, string name) {
return Util.md5(Util.md5(password) + " " + Util.md5(Config.instance.SaltMigration) + " " + Util.md5(name));
return Util.md5(Util.md5(password) + " " + Util.md5(Config.instance.SaltPasswords) + " " + Util.md5(name));
}
private string hashPassword(string password) {

@ -130,7 +130,7 @@ namespace FLocal.IISHandler {
this.requestTime = DateTime.Now;
this.design = this.detectDesign();
HttpCookie sessionCookie = this.httprequest.Cookies["session"];
HttpCookie sessionCookie = this.httprequest.Cookies[Config.instance.CookiesPrefix + "_session"];
if(sessionCookie != null && sessionCookie.Value != null && sessionCookie.Value != "") {
try {
var session = Session.LoadByKey(sessionCookie.Value);
@ -142,7 +142,7 @@ namespace FLocal.IISHandler {
}
}
session.updateLastActivity(lastUrl);
HttpCookie newCookie = this.createCookie("session");
HttpCookie newCookie = this.createCookie(Config.instance.CookiesPrefix + "_session");
newCookie.Value = session.sessionKey;
newCookie.Expires = DateTime.Now.AddDays(3);
this.httpresponse.AppendCookie(newCookie);

@ -43,7 +43,7 @@ namespace FLocal.IISHandler.handlers.request {
Account account = Account.tryAuthorize(context.httprequest.Form["name"], context.httprequest.Form["password"]);
Session session = Session.create(account);
HttpCookie sessionCookie = context.createCookie("session");
HttpCookie sessionCookie = context.createCookie(Config.instance.CookiesPrefix + "_session");
sessionCookie.Value = session.sessionKey;
sessionCookie.Expires = DateTime.Now.AddDays(3);
context.httpresponse.AppendCookie(sessionCookie);

@ -26,10 +26,11 @@ namespace FLocal.IISHandler.handlers.request {
}
context.session.delete();
HttpCookie sessionCookie = context.createCookie("session");
HttpCookie sessionCookie = context.createCookie(Config.instance.CookiesPrefix + "_session");
sessionCookie.Value = "";
sessionCookie.Expires = DateTime.Now.AddDays(-1);
context.httpresponse.AppendCookie(sessionCookie);
context.session = null;
return new XElement[0];

Loading…
Cancel
Save