mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 12:11:12 +08:00
FIX: /my/preferences
should prompt users to log in
This commit is contained in:
@ -80,7 +80,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
const shouldRedirectToUrl = self.session.get("shouldRedirectToUrl");
|
const shouldRedirectToUrl = self.session.get("shouldRedirectToUrl");
|
||||||
$hidden_login_form.find('input[name=username]').val(self.get('loginName'));
|
$hidden_login_form.find('input[name=username]').val(self.get('loginName'));
|
||||||
$hidden_login_form.find('input[name=password]').val(self.get('loginPassword'));
|
$hidden_login_form.find('input[name=password]').val(self.get('loginPassword'));
|
||||||
if (self.get('loginRequired') && destinationUrl) {
|
if (destinationUrl) {
|
||||||
// redirect client to the original URL
|
// redirect client to the original URL
|
||||||
$.cookie('destination_url', null);
|
$.cookie('destination_url', null);
|
||||||
$hidden_login_form.find('input[name=redirect]').val(destinationUrl);
|
$hidden_login_form.find('input[name=redirect]').val(destinationUrl);
|
||||||
|
@ -162,11 +162,15 @@ class UsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def my_redirect
|
def my_redirect
|
||||||
if current_user.present? && params[:path] =~ /^[a-z\-\/]+$/
|
|
||||||
redirect_to path("/users/#{current_user.username}/#{params[:path]}")
|
raise Discourse::NotFound if params[:path] !~ /^[a-z\-\/]+$/
|
||||||
return
|
|
||||||
|
if current_user.blank?
|
||||||
|
cookies[:destination_url] = "/my/#{params[:path]}"
|
||||||
|
redirect_to :login
|
||||||
|
else
|
||||||
|
redirect_to(path("/users/#{current_user.username}/#{params[:path]}"))
|
||||||
end
|
end
|
||||||
raise Discourse::NotFound
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def invited
|
def invited
|
||||||
|
Reference in New Issue
Block a user