Skip to content

Commit

Permalink
DEV: Bump rotp gem to latest version (#10472)
Browse files Browse the repository at this point in the history
The rotp gem is currently pinned to version 5.1.0 and this will bump it
up to version 6.0.1.

Follow up to: 85d4370

because this issue we were waiting on is now closed:

mdp/rotp#98

Because version 6 is now encoding the params I needed to update the
tests as well.
  • Loading branch information
oblakeerickson committed Aug 19, 2020
1 parent c767fb1 commit ea2e58e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Expand Up @@ -223,8 +223,7 @@ gem 'logster'
gem 'sassc', '2.0.1', require: false
gem "sassc-rails"

# see: https://github.com/mdp/rotp/issues/98
gem 'rotp', '5.1.0' , require: false
gem 'rotp', require: false

gem 'rqrcode'

Expand Down
5 changes: 2 additions & 3 deletions Gemfile.lock
Expand Up @@ -315,8 +315,7 @@ GEM
rack (>= 1.4)
rexml (3.2.4)
rinku (2.0.6)
rotp (5.1.0)
addressable (~> 2.5)
rotp (6.1.0)
rqrcode (1.1.2)
chunky_png (~> 1.0)
rqrcode_core (~> 0.1)
Expand Down Expand Up @@ -534,7 +533,7 @@ DEPENDENCIES
redis
redis-namespace
rinku
rotp (= 5.1.0)
rotp
rqrcode
rspec
rspec-html-matchers
Expand Down
6 changes: 3 additions & 3 deletions spec/components/concern/second_factor_manager_spec.rb
Expand Up @@ -44,19 +44,19 @@
describe '#totp_provisioning_uri' do
it 'should return the right uri' do
expect(user.user_second_factors.totps.first.totp_provisioning_uri).to eq(
"otpauth://totp/#{SiteSetting.title}:#{user.email}?secret=#{user_second_factor_totp.data}&issuer=#{SiteSetting.title}"
"otpauth://totp/#{SiteSetting.title}:#{ERB::Util.url_encode(user.email)}?secret=#{user_second_factor_totp.data}&issuer=#{SiteSetting.title}"
)
end
it 'should handle a colon in the site title' do
SiteSetting.title = 'Spaceballs: The Discourse'
expect(user.user_second_factors.totps.first.totp_provisioning_uri).to eq(
"otpauth://totp/Spaceballs%20The%20Discourse:#{user.email}?secret=#{user_second_factor_totp.data}&issuer=Spaceballs+The+Discourse"
"otpauth://totp/Spaceballs%20The%20Discourse:#{ERB::Util.url_encode(user.email)}?secret=#{user_second_factor_totp.data}&issuer=Spaceballs%20The%20Discourse"
)
end
it 'should handle a two words before a colon in the title' do
SiteSetting.title = 'Our Spaceballs: The Discourse'
expect(user.user_second_factors.totps.first.totp_provisioning_uri).to eq(
"otpauth://totp/Our%20Spaceballs%20The%20Discourse:#{user.email}?secret=#{user_second_factor_totp.data}&issuer=Our+Spaceballs+The+Discourse"
"otpauth://totp/Our%20Spaceballs%20The%20Discourse:#{ERB::Util.url_encode(user.email)}?secret=#{user_second_factor_totp.data}&issuer=Our%20Spaceballs%20The%20Discourse"
)
end
end
Expand Down

0 comments on commit ea2e58e

Please sign in to comment.