review: use salt to generate key
This commit is contained in:
parent
f154bb56e6
commit
9aaef79a3d
4 changed files with 4 additions and 4 deletions
|
@ -41,7 +41,7 @@ module Manager
|
|||
|
||||
def decrypted_params
|
||||
@decrypted_params ||= ActiveSupport::MessageVerifier.new(
|
||||
Rails.application.key_generator.generate_key(ENV["SECRET_KEY_BASE"])
|
||||
Rails.application.key_generator.generate_key("confirm_adding_administrateur")
|
||||
).verify(Base64.urlsafe_decode64(params[:q]))
|
||||
end
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ module Manager
|
|||
end
|
||||
|
||||
def encrypt(parameters)
|
||||
key = Rails.application.key_generator.generate_key(ENV["SECRET_KEY_BASE"])
|
||||
key = Rails.application.key_generator.generate_key("confirm_adding_administrateur")
|
||||
verifier = ActiveSupport::MessageVerifier.new(key)
|
||||
Base64.urlsafe_encode64(verifier.generate(parameters))
|
||||
end
|
||||
|
|
|
@ -157,7 +157,7 @@ RSpec.describe Manager::AdministrateurConfirmationsController, type: :controller
|
|||
private
|
||||
|
||||
def encrypt(parameters)
|
||||
key = Rails.application.key_generator.generate_key(ENV["SECRET_KEY_BASE"])
|
||||
key = Rails.application.key_generator.generate_key("confirm_adding_administrateur")
|
||||
verifier = ActiveSupport::MessageVerifier.new(key)
|
||||
Base64.urlsafe_encode64(verifier.generate(parameters))
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@ describe Manager::ConfirmationUrlsController, type: :controller do
|
|||
private
|
||||
|
||||
def encrypt(parameters)
|
||||
key = Rails.application.key_generator.generate_key(ENV["SECRET_KEY_BASE"])
|
||||
key = Rails.application.key_generator.generate_key("confirm_adding_administrateur")
|
||||
verifier = ActiveSupport::MessageVerifier.new(key)
|
||||
Base64.urlsafe_encode64(verifier.generate(parameters))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue