An alternative to UBB.threads
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
using FLocal.Common.dataobjects;
|
|
|
|
|
using FLocal.Importer;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using FLocal.Core;
|
|
|
|
|
using FLocal.Common;
|
|
|
|
|
using FLocal.Common.actions;
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
|
|
|
|
namespace FLocal.IISHandler.handlers.request {
|
|
|
|
|
class LoginHandler : AbstractPostHandler {
|
|
|
|
|
|
|
|
|
|
protected override string templateName {
|
|
|
|
|
get {
|
|
|
|
|
return "result/Login.xslt";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool shouldBeLoggedIn {
|
|
|
|
|
get { return false; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool shouldBeGuest {
|
|
|
|
|
get { return true; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override XElement[] Do(WebContext context) {
|
|
|
|
|
Account account = Account.tryAuthorize(context.httprequest.Form["name"], context.httprequest.Form["password"]);
|
|
|
|
|
Session session = Session.create(account);
|
|
|
|
|
|
|
|
|
|
HttpCookie sessionCookie = context.createCookie("session");
|
|
|
|
|
sessionCookie.Value = session.sessionKey;
|
|
|
|
|
sessionCookie.Expires = DateTime.Now.AddDays(3);
|
|
|
|
|
context.httpresponse.AppendCookie(sessionCookie);
|
|
|
|
|
context.session = session;
|
|
|
|
|
|
|
|
|
|
return new XElement[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|