From: Tom Hughes Date: Mon, 3 Aug 2009 23:50:47 +0000 (+0000) Subject: Merge 16743:16811 from trunk. X-Git-Tag: live~6749^2~10 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/cbbfdf394880d29c9a6cc2259fcfd474088fa9bb Merge 16743:16811 from trunk. --- cbbfdf394880d29c9a6cc2259fcfd474088fa9bb diff --cc app/controllers/user_controller.rb index 1e70fe08f,c3ab012e3..6f57f4f4a --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@@ -98,9 -95,9 +98,9 @@@ class UserController < ApplicationContr if user token = user.tokens.create Notifier.deliver_lost_password(user, token) -- flash[:notice] = t 'user.lost_password.notice email on way' ++ @notice = t 'user.lost_password.notice email on way' else -- flash[:notice] = t 'user.lost_password.notice email cannot find' ++ @notice = t 'user.lost_password.notice email cannot find' end end end @@@ -108,25 -105,25 +108,28 @@@ def reset_password @title = t 'user.reset_password.title' -- if params['token'] ++ if params[:token] token = UserToken.find_by_token(params[:token]) ++ if token -- pass = OSM::make_token(8) -- user = token.user -- user.pass_crypt = pass -- user.pass_crypt_confirmation = pass -- user.active = true -- user.email_valid = true -- user.save! -- token.destroy -- Notifier.deliver_reset_password(user, pass) -- flash[:notice] = t 'user.reset_password.flash changed check mail' ++ if params[:user] ++ @user = token.user ++ @user.pass_crypt = params[:user][:pass_crypt] ++ @user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation] ++ @user.active = true ++ @user.email_valid = true ++ ++ if @user.save ++ token.destroy ++ flash[:notice] = t 'user.reset_password.flash changed' ++ redirect_to :action => 'login' ++ end ++ end else flash[:notice] = t 'user.reset_password.flash token bad' ++ redirect_to :action => 'lost_password' end end -- -- redirect_to :action => 'login' end def new diff --cc app/models/notifier.rb index ba4530e99,ba4530e99..35b521e1f --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@@ -22,13 -22,13 +22,7 @@@ class Notifier < ActionMailer::Bas subject I18n.t('notifier.lost_password.subject') body :url => url_for(:host => SERVER_URL, :controller => "user", :action => "reset_password", -- :email => user.email, :token => token.token) -- end -- -- def reset_password(user, pass) -- common_headers user -- subject I18n.t('notifier.reset_password.subject') -- body :pass => pass ++ :token => token.token) end def gpx_success(trace, possible_points) diff --cc app/views/notifier/reset_password.text.html.erb index 39ea35b5e,39ea35b5e..000000000 deleted file mode 100644,100644 --- a/app/views/notifier/reset_password.text.html.erb +++ /dev/null @@@ -1,3 -1,3 +1,0 @@@ --

<%= t 'notifier.reset_password_html.greeting' %>

-- --

<%= t 'notifier.reset_password_html.reset', :new_password => @pass %>

diff --cc app/views/notifier/reset_password.text.plain.erb index aab4d137b,aab4d137b..000000000 deleted file mode 100644,100644 --- a/app/views/notifier/reset_password.text.plain.erb +++ /dev/null @@@ -1,3 -1,3 +1,0 @@@ --<%= t 'notifier.reset_password_plain.greeting' %> -- --<%= t 'notifier.reset_password_plain.reset', :new_password => @pass %> diff --cc app/views/user/reset_password.html.erb index 000000000,000000000..458a6084c new file mode 100644 --- /dev/null +++ b/app/views/user/reset_password.html.erb @@@ -1,0 -1,0 +1,14 @@@ ++

<%= t 'user.reset_password.heading' %>

++ ++<%= error_messages_for :user %> ++ ++<% form_tag do %> ++<%= hidden_field_tag(:token, params[:token]) %> ++ ++ ++ ++ ++ ++ ++
<%= t 'user.reset_password.password' %><%= password_field(:user, :pass_crypt,{:size => 30, :maxlength => 255, :tabindex => 4}) %>
<%= t 'user.reset_password.confirm password' %><%= password_field(:user, :pass_crypt_confirmation,{:size => 30, :maxlength => 255, :tabindex => 5}) %>
 
++<% end %> diff --cc config/locales/en.yml index 8c685df65,3b049b12a..97fe3ab01 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -533,14 -533,14 +533,6 @@@ en greeting: "Hi," hopefully_you: "Someone (possibly you) has asked for the password to be reset on this email address's openstreetmap.org account." click_the_link: "If this is you, please click the link below to reset your password." -- reset_password: -- subject: "[OpenStreetMap] Password reset" -- reset_password_plain: -- greeting: "Hi," -- reset: "Your password has been reset to {{new_password}}" -- reset_password_html: -- greeting: "Hi," -- reset: "Your password has been reset to {{new_password}}" message: inbox: title: "Inbox" @@@ -852,15 -796,15 +844,19 @@@ account not active: "Sorry, your account is not active yet.
Please click on the link in the account confirmation email to activate your account." auth failure: "Sorry, couldn't log in with those details." lost_password: -- title: "lost password" ++ title: "Lost password" heading: "Forgotten Password?" email address: "Email Address:" new password button: "Send me a new password" notice email on way: "Sorry you lost it :-( but an email is on its way so you can reset it soon." notice email cannot find: "Couldn't find that email address, sorry." reset_password: -- title: "reset password" -- flash changed check mail: "Your password has been changed and is on its way to your mailbox :-)" ++ title: "Reset password" ++ heading: "Reset Password" ++ password: "Password: " ++ confirm password: "Confirm Password: " ++ reset: "Reset Password" ++ flash changed: "Your password has been changed." flash token bad: "Didn't find that token, check the URL maybe?" new: title: "Create account" diff --cc db/migrate/038_add_message_sender_index.rb index 000000000,000000000..2b9b134cd new file mode 100644 --- /dev/null +++ b/db/migrate/038_add_message_sender_index.rb @@@ -1,0 -1,0 +1,9 @@@ ++class AddMessageSenderIndex < ActiveRecord::Migration ++ def self.up ++ add_index :messages, [:from_user_id], :name=> "messages_from_user_id_idx" ++ end ++ ++ def self.down ++ drop_index :messages, :name=> "messages_from_user_id_idx" ++ end ++end diff --cc db/migrate/039_create_oauth_tables.rb index 95d690512,000000000..95d690512 mode 100644,000000..100644 --- a/db/migrate/039_create_oauth_tables.rb +++ b/db/migrate/039_create_oauth_tables.rb diff --cc db/migrate/040_add_fine_o_auth_permissions.rb index ad4c7a8a4,000000000..ad4c7a8a4 mode 100644,000000..100644 --- a/db/migrate/040_add_fine_o_auth_permissions.rb +++ b/db/migrate/040_add_fine_o_auth_permissions.rb diff --cc db/migrate/041_add_foreign_keys_to_oauth_tables.rb index 09de54349,000000000..09de54349 mode 100644,000000..100644 --- a/db/migrate/041_add_foreign_keys_to_oauth_tables.rb +++ b/db/migrate/041_add_foreign_keys_to_oauth_tables.rb