Maintenance: Increase performance of ticket creation via form.
This commit is contained in:
parent
ecbda834bc
commit
1285c88ca3
1 changed files with 2 additions and 2 deletions
|
@ -156,7 +156,7 @@ class FormController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def token_gen(fingerprint)
|
def token_gen(fingerprint)
|
||||||
crypt = ActiveSupport::MessageEncryptor.new(Setting.get('application_secret')[0, 32])
|
crypt = ActiveSupport::MessageEncryptor.new(Setting.get('application_secret')[0, 32], serializer: JSON)
|
||||||
fingerprint = "#{Base64.strict_encode64(Setting.get('fqdn'))}:#{Time.zone.now.to_i}:#{Base64.strict_encode64(fingerprint)}"
|
fingerprint = "#{Base64.strict_encode64(Setting.get('fqdn'))}:#{Time.zone.now.to_i}:#{Base64.strict_encode64(fingerprint)}"
|
||||||
Base64.strict_encode64(crypt.encrypt_and_sign(fingerprint))
|
Base64.strict_encode64(crypt.encrypt_and_sign(fingerprint))
|
||||||
end
|
end
|
||||||
|
@ -167,7 +167,7 @@ class FormController < ApplicationController
|
||||||
raise Exceptions::Forbidden
|
raise Exceptions::Forbidden
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
crypt = ActiveSupport::MessageEncryptor.new(Setting.get('application_secret')[0, 32])
|
crypt = ActiveSupport::MessageEncryptor.new(Setting.get('application_secret')[0, 32], serializer: JSON)
|
||||||
result = crypt.decrypt_and_verify(Base64.decode64(token))
|
result = crypt.decrypt_and_verify(Base64.decode64(token))
|
||||||
rescue
|
rescue
|
||||||
Rails.logger.info 'Invalid token for form!'
|
Rails.logger.info 'Invalid token for form!'
|
||||||
|
|
Loading…
Reference in a new issue