* Added User.popLocation() and User.popLocation() methods for temporarily storing a user's location, ie. to get back where the user came from when it was necessary to login

* Removed Root.searchSites() method (will be back later)
 * Added checks for empty searches in Site.search_action()
This commit is contained in:
Tobi Schäfer 2007-10-17 16:25:01 +00:00
parent 3d0fae4302
commit 1c3c51a0e1
7 changed files with 46 additions and 72 deletions

View file

@ -81,11 +81,9 @@ Members.prototype.register_action = function() {
this.add(membership);
membership.notify(req.action, user.email,
gettext('Welcome to "{0}"!', title));
var url = session.data.referrer || this._parent.href();
delete session.data.referrer;
res.message = gettext('Welcome to "{0}", {1}. Have fun!',
title, user.name);
res.redirect(url);
res.redirect(User.popLocation() || this._parent.href());
} catch (ex) {
app.log(ex);
res.message = ex;
@ -134,20 +132,16 @@ Members.prototype.login_action = function() {
if (req.postParams.login) {
try {
var user = User.login(req.postParams);
var url = session.data.referrer || this._parent.href();
delete session.data.referrer;
res.message = gettext('Welcome to "{0}", {1}. Have fun!',
res.handlers.site.getTitle(), user.name);
res.redirect(url);
res.redirect(User.popLocation() || this._parent.href());
} catch (ex) {
res.message = ex;
app.log(ex);
}
}
if (!session.data.referrer) {
session.data.referrer = req.data.http_referer;
}
User.pushLocation(req.data.http_referer);
session.data.token = User.getSalt();
res.data.action = this.href(req.action);
res.data.title = gettext("Login");