* Simplified User.pushLocation() and User.popLocation() methods
* Added location pushing / popping to Members.login_action() method
This commit is contained in:
parent
f2aa28ead2
commit
e2a849b2cc
3 changed files with 6 additions and 7 deletions
|
|
@ -170,7 +170,7 @@ Members.prototype.login_action = function() {
|
|||
}
|
||||
}
|
||||
|
||||
User.pushLocation(req.data.http_referer);
|
||||
User.pushLocation();
|
||||
session.data.token = User.getSalt();
|
||||
res.data.action = this.href(req.action);
|
||||
res.data.title = gettext("Login to {0}", this._parent.title);
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ Site.prototype.getPermission = function(action) {
|
|||
|
||||
case "unsubscribe":
|
||||
var membership = this.members.get(session.user.name);
|
||||
return User.require(User.REGULAR) &&
|
||||
return User.require(User.REGULAR) && membership &&
|
||||
!membership.require(Membership.OWNER);
|
||||
}
|
||||
return false;
|
||||
|
|
@ -475,12 +475,14 @@ Site.prototype.unsubscribe_action = function() {
|
|||
Membership.remove(Membership.getByName(session.user.name));
|
||||
res.message = gettext("Successfully unsubscribed from site {0}.",
|
||||
this.title);
|
||||
res.redirect(this.href());
|
||||
res.redirect(User.popLocation() || this.href());
|
||||
} catch (ex) {
|
||||
app.log(ex)
|
||||
res.message = ex.toString();
|
||||
}
|
||||
}
|
||||
|
||||
User.pushLocation();
|
||||
res.data.title = gettext("Remove subscription to {0}", this.title);
|
||||
res.data.body = this.renderSkinAsString("$HopObject#confirm", {
|
||||
text: gettext('You are about to unsubscribe from site {0}.', this.title)
|
||||
|
|
|
|||
|
|
@ -260,10 +260,7 @@ User.getMembership = function() {
|
|||
}
|
||||
|
||||
User.pushLocation = function(url) {
|
||||
if (!session.data.location) {
|
||||
//res.debug("Pushing location " + url);
|
||||
session.data.location = url;
|
||||
}
|
||||
session.data.location = url || req.data.http_referer;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue