]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/site_controller.rb
Remove dot prefix from cookie domain
[rails.git] / app / controllers / site_controller.rb
index 1a4c9f148425eef9621568d8d822fd0a49a1a916..71285356aeb39f4d350ba4d5c0ad5def28161639 100644 (file)
@@ -13,6 +13,14 @@ class SiteController < ApplicationController
     unless STATUS == :database_readonly || STATUS == :database_offline
       session[:location] ||= OSM.ip_location(request.env["REMOTE_ADDR"])
     end
+
+    if defined?(TOTP_KEY)
+      cookies["_osm_totp_token"] = {
+        :value => ROTP::TOTP.new(TOTP_KEY, :interval => 3600).now,
+        :domain => "openstreetmap.org",
+        :expires => 1.hour.from_now
+      }
+    end
   end
 
   def permalink