mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: You can reset your password even if logins are required.
This commit is contained in:
@ -12,7 +12,13 @@ class UsersController < ApplicationController
|
|||||||
# page is going to be empty, this means that server will see an invalid CSRF and blow the session
|
# page is going to be empty, this means that server will see an invalid CSRF and blow the session
|
||||||
# once that happens you can't log in with social
|
# once that happens you can't log in with social
|
||||||
skip_before_filter :verify_authenticity_token, only: [:create]
|
skip_before_filter :verify_authenticity_token, only: [:create]
|
||||||
skip_before_filter :redirect_to_login_if_required, only: [:check_username,:create,:get_honeypot_value,:activate_account,:send_activation_email,:authorize_email]
|
skip_before_filter :redirect_to_login_if_required, only: [:check_username,
|
||||||
|
:create,
|
||||||
|
:get_honeypot_value,
|
||||||
|
:activate_account,
|
||||||
|
:send_activation_email,
|
||||||
|
:authorize_email,
|
||||||
|
:password_reset]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@user = fetch_user_from_params
|
@user = fetch_user_from_params
|
||||||
|
@ -216,6 +216,17 @@ describe UsersController do
|
|||||||
describe '.password_reset' do
|
describe '.password_reset' do
|
||||||
let(:user) { Fabricate(:user) }
|
let(:user) { Fabricate(:user) }
|
||||||
|
|
||||||
|
context "you can view it even if login is required" do
|
||||||
|
before do
|
||||||
|
SiteSetting.stubs(:login_required).returns(true)
|
||||||
|
get :password_reset, token: 'asdfasdf'
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns success" do
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'invalid token' do
|
context 'invalid token' do
|
||||||
before do
|
before do
|
||||||
EmailToken.expects(:confirm).with('asdfasdf').returns(nil)
|
EmailToken.expects(:confirm).with('asdfasdf').returns(nil)
|
||||||
|
Reference in New Issue
Block a user