fix build & add migration to clear common passwords cache

This commit is contained in:
Régis Hanol 2016-03-03 19:39:22 +01:00
parent 341037d6fb
commit 8d4bac7da2
3 changed files with 10 additions and 4 deletions

View file

@ -0,0 +1,7 @@
require "common_passwords/common_passwords"
class ClearCommonPasswordsCache < ActiveRecord::Migration
def change
$redis.without_namespace.del CommonPasswords::LIST_KEY
end
end

View file

@ -21,7 +21,6 @@ class CommonPasswords
password_list.include?(password)
end
private
class RedisPasswordList

View file

@ -333,7 +333,7 @@ describe UsersController do
old_token = user.auth_token
get :password_reset, token: token
put :password_reset, token: token, password: 'newpassword'
put :password_reset, token: token, password: 'hg9ow8yhg98o'
expect(response).to be_success
expect(assigns[:error]).to be_blank
@ -372,14 +372,14 @@ describe UsersController do
end
it "logs in the user" do
put :password_reset, token: token, password: 'newpassword'
put :password_reset, token: token, password: 'ksjafh928r'
expect(assigns(:user).errors).to be_blank
expect(session[:current_user_id]).to be_present
end
it "doesn't log in the user when not approved" do
SiteSetting.expects(:must_approve_users?).returns(true)
put :password_reset, token: token, password: 'newpassword'
put :password_reset, token: token, password: 'ksjafh928r'
expect(assigns(:user).errors).to be_blank
expect(session[:current_user_id]).to be_blank
end