parent
f79c52b8c3
commit
b74261205d
3 changed files with 23 additions and 5 deletions
2
Gemfile
2
Gemfile
|
@ -63,7 +63,7 @@ gem 'barnes'
|
||||||
|
|
||||||
##--- gems for authentication & authorization ---##
|
##--- gems for authentication & authorization ---##
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'devise-secure_password', '~> 2.0'
|
gem 'devise-secure_password', '~> 2.0', git: 'https://github.com/chatwoot/devise-secure_password'
|
||||||
gem 'devise_token_auth'
|
gem 'devise_token_auth'
|
||||||
# authorization
|
# authorization
|
||||||
gem 'jwt'
|
gem 'jwt'
|
||||||
|
|
14
Gemfile.lock
14
Gemfile.lock
|
@ -1,3 +1,11 @@
|
||||||
|
GIT
|
||||||
|
remote: https://github.com/chatwoot/devise-secure_password
|
||||||
|
revision: de11e8765654b8242d42101ee9c8ffc8126f7975
|
||||||
|
specs:
|
||||||
|
devise-secure_password (2.0.1)
|
||||||
|
devise (>= 4.0.0, < 5.0.0)
|
||||||
|
railties (>= 5.0.0, < 7.0.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
@ -152,9 +160,6 @@ GEM
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
responders
|
responders
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
devise-secure_password (2.0.1)
|
|
||||||
devise (>= 4.0.0, < 5.0.0)
|
|
||||||
railties (>= 5.0.0, < 7.0.0)
|
|
||||||
devise_token_auth (1.2.0)
|
devise_token_auth (1.2.0)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
devise (> 3.5.2, < 5)
|
devise (> 3.5.2, < 5)
|
||||||
|
@ -612,6 +617,7 @@ GEM
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
arm64-darwin-20
|
arm64-darwin-20
|
||||||
|
x86_64-darwin-18
|
||||||
x86_64-darwin-20
|
x86_64-darwin-20
|
||||||
x86_64-darwin-21
|
x86_64-darwin-21
|
||||||
x86_64-linux
|
x86_64-linux
|
||||||
|
@ -637,7 +643,7 @@ DEPENDENCIES
|
||||||
database_cleaner
|
database_cleaner
|
||||||
ddtrace
|
ddtrace
|
||||||
devise
|
devise
|
||||||
devise-secure_password (~> 2.0)
|
devise-secure_password (~> 2.0)!
|
||||||
devise_token_auth
|
devise_token_auth
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
down (~> 5.0)
|
down (~> 5.0)
|
||||||
|
|
|
@ -18,6 +18,7 @@ RSpec.describe 'Session', type: :request do
|
||||||
|
|
||||||
context 'when it is valid credentials' do
|
context 'when it is valid credentials' do
|
||||||
let!(:user) { create(:user, password: 'Password1!', account: account) }
|
let!(:user) { create(:user, password: 'Password1!', account: account) }
|
||||||
|
let!(:user_with_new_pwd) { create(:user, password: 'Password1!.><?', account: account) }
|
||||||
|
|
||||||
it 'returns successful auth response' do
|
it 'returns successful auth response' do
|
||||||
params = { email: user.email, password: 'Password1!' }
|
params = { email: user.email, password: 'Password1!' }
|
||||||
|
@ -29,6 +30,17 @@ RSpec.describe 'Session', type: :request do
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
expect(response.body).to include(user.email)
|
expect(response.body).to include(user.email)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns successful auth response with new password special characters' do
|
||||||
|
params = { email: user_with_new_pwd.email, password: 'Password1!.><?' }
|
||||||
|
|
||||||
|
post new_user_session_url,
|
||||||
|
params: params,
|
||||||
|
as: :json
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:success)
|
||||||
|
expect(response.body).to include(user_with_new_pwd.email)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when it is invalid sso auth token' do
|
context 'when it is invalid sso auth token' do
|
||||||
|
|
Loading…
Reference in a new issue