From: Tom Hughes Date: Wed, 8 Nov 2023 22:53:18 +0000 (+0000) Subject: Use the URL safe base64 variant for mail tokens X-Git-Tag: live~974 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/68845eb7253cd3da14253e004fc1a4fc7eac2e5e Use the URL safe base64 variant for mail tokens --- diff --git a/app/models/diary_comment.rb b/app/models/diary_comment.rb index 8663212eb..55d2c3c84 100644 --- a/app/models/diary_comment.rb +++ b/app/models/diary_comment.rb @@ -42,7 +42,7 @@ class DiaryComment < ApplicationRecord sha256 << Rails.application.key_generator.generate_key("openstreetmap/diary_comment") sha256 << id.to_s sha256 << subscriber.to_s - sha256.base64digest[0, 8] + Base64.urlsafe_encode64(sha256.digest)[0, 8] end private diff --git a/app/models/message.rb b/app/models/message.rb index 0068bc3de..7c12769d3 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -63,6 +63,6 @@ class Message < ApplicationRecord sha256 = Digest::SHA256.new sha256 << Rails.application.key_generator.generate_key("openstreetmap/message") sha256 << id.to_s - sha256.base64digest[0, 8] + Base64.urlsafe_encode64(sha256.digest)[0, 8] end end