Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Password reset - make emails friendlier and fix blank page #149

Merged
merged 3 commits into from

3 participants

@pozorvlak
Collaborator

No description provided.

Skud and others added some commits
@Skud Skud fixes the blank form when resetting password cc987b4
@Skud Skud Made the password reset email friendlier.
Also did the same for the unlock instructions, while I was in there.
dcd7df7
@pozorvlak pozorvlak Fix broken test for unlock instructions
There were some extra assertions left over from Devise's use of mocks that no
longer make sense.
5d09386
@pozorvlak pozorvlak merged commit 37e406d into Growstuff:dev
@pozorvlak pozorvlak deleted the pozorvlak:password-reset branch
@phazel phazel commented on the diff
config/locales/devise.en.yml
((6 lines not shown))
unlock_instructions:
- subject: 'Unlock Instructions'
+ subject: 'Unlock your Growstuff account'
@phazel
phazel added a note

Shouldn't these 'Growstuff's be the config variable instead?

@Skud Owner
Skud added a note

In theory, yes, but in practice YAML's syntax is different and we weren't sure how to do it. We've forked off a bug report for it in PT, here: https://www.pivotaltracker.com/story/show/46876755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2013
  1. @Skud
  2. @Skud

    Made the password reset email friendlier.

    Skud authored
    Also did the same for the unlock instructions, while I was in there.
Commits on Mar 27, 2013
  1. @pozorvlak

    Fix broken test for unlock instructions

    pozorvlak authored
    There were some extra assertions left over from Devise's use of mocks that no
    longer make sense.
This page is out of date. Refresh to see the latest.
View
5 app/views/devise/mailer/confirmation_instructions.html.haml
@@ -1,8 +1,5 @@
- site_name = Growstuff::Application.config.site_name
-%p
- Welcome,
- = @resource.login_name
- !
+%p Hello #{@resource.login_name},
%p
Your account on #{site_name} has been created. You just need to confirm
View
21 app/views/devise/mailer/reset_password_instructions.html.haml
@@ -1,12 +1,19 @@
-%p
- Hello
- = @resource.email
- !
+- site_name = Growstuff::Application.config.site_name
+%p Hello #{@resource.login_name},
-%p Someone has requested a link to change your password, and you can do this through the link below.
+%p Someone has requested a link to reset your password on #{site_name}.
+We presume this was you, in which case you can do so through this link:
%p
= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
-%p If you didn't request this, please ignore this email.
-%p Your password won't change until you access the link above and create a new one.
+%p If it wasn't you, then someone's made a typo or has been messing
+around. In this case, you can safely ignore this email, and your
+password will not be changed.
+
+%p See you soon,
+
+%p The #{site_name} team.
+%br/
+=link_to root_url, root_url
+
View
25 app/views/devise/mailer/unlock_instructions.html.haml
@@ -1,13 +1,20 @@
-%p
- Hello
- = @resource.email
- !
+- site_name = Growstuff::Application.config.site_name
+%p Hello #{@resource.login_name},
%p
- Your account has been locked due to an excessive amount of unsuccessful sign
- in attempts.
+ Your #{site_name} account has been locked due to an excessive number
+ of unsuccessful sign in attempts. We do this in case someone's trying
+ to break into your account, but it might also mean you've just
+ forgotten your password. In either case, use the link below to unlock
+ your account:
-%p Click the link below to unlock your account:
+%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
-%p
- = link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
+%p If you have actually forgotten your password, you can
+= link_to 'reset your password', new_password_url(@resource)
+after you've unlocked your account.
+
+%p See you soon,
+%p The #{site_name} team.
+%br/
+=link_to root_url, root_url
View
2  app/views/devise/passwords/edit.html.haml
@@ -1,6 +1,6 @@
- content_for :title, "Change your password"
-- form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
+= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
= devise_error_messages!
= f.hidden_field :reset_password_token
View
4 config/locales/devise.en.yml
@@ -58,6 +58,6 @@ en:
confirmation_instructions:
subject: 'Welcome to Growstuff. Please confirm your account.'
reset_password_instructions:
- subject: 'Reset password instructions'
+ subject: 'Growstuff password reset instructions'
unlock_instructions:
- subject: 'Unlock Instructions'
+ subject: 'Unlock your Growstuff account'
@phazel
phazel added a note

Shouldn't these 'Growstuff's be the config variable instead?

@Skud Owner
Skud added a note

In theory, yes, but in practice YAML's syntax is different and we weren't sure how to do it. We've forked off a bug report for it in PT, here: https://www.pivotaltracker.com/story/show/46876755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
2  spec/views/devise/mailer/reset_password_instructions_spec.rb
@@ -12,7 +12,7 @@
it 'should have some of the right text' do
rendered.should contain 'Change my password'
- rendered.should contain 'please ignore this email'
+ rendered.should contain 'Someone has requested a link to reset your password'
end
end
end
View
7 spec/views/devise/mailer/unlock_instructions_spec.rb
@@ -1,14 +1,13 @@
+require 'spec_helper'
describe 'devise/mailer/unlock_instructions.html.haml', :type => "view" do
context "logged in" do
before(:each) do
- @resource = mock_model(Member)
- @resource.should_receive(:email).and_return("example@example.com")
- @resource.should_receive(:unlock_token).and_return("fred")
+ @resource = FactoryGirl.create(:member)
render
end
it "should explain what's happened" do
- rendered.should contain "Your account has been locked"
+ rendered.should contain "account has been locked"
end
it "should have an unlock link" do
Something went wrong with that request. Please try again.