]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'master' into openid
authorTom Hughes <tom@compton.nu>
Fri, 10 Jun 2011 18:11:08 +0000 (19:11 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 10 Jun 2011 18:11:08 +0000 (19:11 +0100)
app/controllers/application_controller.rb
app/controllers/user_controller.rb
app/models/user.rb
app/models/user_sweeper.rb
app/views/user/login.html.erb
config/locales/en.yml
vendor/plugins/session-persistence/lib/session_persistence.rb

index 6c19b3a529c26a4c463dcc350034280649adfb27..1d3297d16eb4ceabe4994a04293850dfbb849f9a 100644 (file)
@@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
       @user = User.find(session[:user], :conditions => {:status => ["active", "confirmed", "suspended"]})
 
       if @user.status == "suspended"
-        session[:user] = nil
+        session.delete(:user)
         session_expires_automatically
 
         redirect_to :controller => "user", :action => "suspended"
@@ -61,11 +61,14 @@ class ApplicationController < ActionController::Base
   def require_cookies
     if request.cookies["_osm_session"].to_s == ""
       if params[:cookie_test].nil?
+        session[:cookie_test] = true
         redirect_to params.merge(:cookie_test => "true")
         return false
       else
         flash.now[:warning] = t 'application.require_cookies.cookies_needed'
       end
+    else
+      session.delete(:cookie_test)
     end
   end
 
index 4128b61d4a0982cf43ba1b79e7bfe45db3c97d05..9e2961df2716fa95696d1efabf92cf5ec57c04ea 100644 (file)
@@ -286,9 +286,9 @@ class UserController < ApplicationController
         if token
           token.destroy
         end
-        session[:token] = nil
+        session.delete(:token)
       end
-      session[:user] = nil
+      session.delete(:user)
       session_expires_automatically
       if params[:referer]
         redirect_to params[:referer]
index 79af5d71f66c1836e69213aa812c7af32b66fcb2..0b2a902dfac734f71d18c183cefe5863e579bbe1 100644 (file)
@@ -26,11 +26,11 @@ class User < ActiveRecord::Base
   validates_uniqueness_of :openid_url, :allow_nil => true
   validates_length_of :pass_crypt, :within => 8..255
   validates_length_of :display_name, :within => 3..255, :allow_nil => true
-  validates_email_format_of :email
-  validates_email_format_of :new_email, :allow_blank => true
-  validates_format_of :display_name, :with => /^[^\/;.,?]*$/
-  validates_format_of :display_name, :with => /^\S/, :message => "has leading whitespace"
-  validates_format_of :display_name, :with => /\S$/, :message => "has trailing whitespace"
+  validates_email_format_of :email, :if => Proc.new { |u| u.email_changed? }
+  validates_email_format_of :new_email, :allow_blank => true, :if => Proc.new { |u| u.new_email_changed? }
+  validates_format_of :display_name, :with => /^[^\/;.,?]*$/, :if => Proc.new { |u| u.display_name_changed? }
+  validates_format_of :display_name, :with => /^\S/, :message => "has leading whitespace", :if => Proc.new { |u| u.display_name_changed? }
+  validates_format_of :display_name, :with => /\S$/, :message => "has trailing whitespace", :if => Proc.new { |u| u.display_name_changed? }
   validates_numericality_of :home_lat, :allow_nil => true
   validates_numericality_of :home_lon, :allow_nil => true
   validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true
index d2fd983f76221d56215eab4c315763ffda02e374..5286b97b189f6c099aa342ce3b5282c46b45bfa0 100644 (file)
@@ -22,6 +22,10 @@ private
         expire_action(:controller => 'diary_entry', :action => 'rss', :language => entry.language_code, :display_name => nil)
       end
 
+      old_record.diary_comments.each do |comment|
+        expire_action(:controller => 'diary_entry', :action => 'view', :display_name => comment.diary_entry.user.display_name, :id => comment.diary_entry.id)
+      end
+
       expire_action(:controller => 'diary_entry', :action => 'list', :language => nil, :display_name => nil)
       expire_action(:controller => 'diary_entry', :action => 'list', :language => nil, :display_name => old_record.display_name)
 
index 0616d76f8aa23c4c31ebb7f09b853aaa42457860..6297b219db58512a29f0973f6def39954b54cf1f 100644 (file)
@@ -9,7 +9,7 @@
       <p><%= t 'user.login.with username' %></p>
 
       <table id="loginForm">
-        <tr><td class="fieldName"><%= t 'user.login.email or username' %></td><td><%= text_field('user', 'email',{:value => "", :size => 28, :maxlength => 255, :tabindex => 1}) %></td></tr>
+        <tr><td class="fieldName"><%= t 'user.login.email or username' %></td><td><%= text_field('user', 'email',{:value => params[:username], :size => 28, :maxlength => 255, :tabindex => 1}) %></td></tr>
         <tr><td class="fieldName"><%= t 'user.login.password' %></td><td><%= password_field('user', 'password',{:value => "", :size => 28, :maxlength => 255, :tabindex => 2}) %> <span class="minorNote">(<%= link_to t('user.login.lost password link'), :controller => 'user', :action => 'lost_password' %>)</span></td></tr>
         <tr><td class="fieldName"><label for="remember_me"><%= t 'user.login.remember' %></label></td><td><%= check_box_tag "remember_me", "yes", false, :tabindex => 3 %></td></tr>
       </table>
index 30901e50a705f47362c40af7286ef35d41fd2731..e41048d0fb0259da4112c6ad6601dc8abbc5a078 100644 (file)
@@ -1056,6 +1056,9 @@ en:
       <ul id="contributors">
           <li><strong>Australia</strong>: Contains suburb data based
           on Australian Bureau of Statistics data.</li>
+          <li><strong>Austria</strong>: Contains data from
+          <a href="http://data.wien.gv.at/">Stadt Wien</a> under
+          <a href="http://creativecommons.org/licenses/by/3.0/at/deed.de">CC-BY</a>.</li>
           <li><strong>Canada</strong>: Contains data from
           GeoBase&reg;, GeoGratis (&copy; Department of Natural
           Resources Canada), CanVec (&copy; Department of Natural
index 50e30c0f131fac8055ad372a780a495055a627fe..2fac6033257c89b8fe9762e19e0351aa0cb42c9d 100644 (file)
@@ -22,9 +22,8 @@ module SessionPersistence
   
   def _persist_session
     if session[session_persistence_key]
-      request.session_options = request.session_options.dup
+      request.session_options[:expires] = Time.now + session[session_persistence_key]
       request.session_options[:expire_after] = session[session_persistence_key]
-      request.session_options.freeze
     end
   end
 end