Permalink
Browse files

Started on forgot password

  • Loading branch information...
1 parent 8819753 commit 284aaf9620280e50f6d71016b12b7a70653998cc @aslakhellesoy committed Sep 23, 2008
@@ -0,0 +1,13 @@
+<r:ba:if_flash key="reset_password_email_sent">
+ We have sent you an email that will allow you to reset the password.
+</r:ba:if_flash>
+
+<form method="post" action=".">
+ <p>
+ <label for="email">Email</label><br/>
+ <input id="email" type="text" name="email" value="<r:ba:request_param name="email" />"/>
+ </p>
+ <p>
+ <input type="submit" value="Send me a reset link" name="commit" />
+ </p>
+</form>
@@ -0,0 +1,24 @@
+class ForgotPasswordPage < Page
+ description %{
+ This page displays a page where people can ask for a reset password link.
+ }
+
+ before_validation_on_create :create_default_content
+
+ def cache?
+ false
+ end
+
+ def process(request, response)
+ super
+ end
+
+ def create_default_content
+ self.parent = Page.find_by_url('/')
+ self.slug = 'forgot'
+ self.breadcrumb = self.title = 'Forgot Password'
+ self.status = Status[:published]
+
+ parts << PagePart.new(:name => 'body', :content => read_file('default_forgot_password_part.html'))
+ end
+end
@@ -0,0 +1,9 @@
+class CreateForgotPasswordPage < ActiveRecord::Migration
+ def self.up
+ ForgotPasswordPage.create!
+ end
+
+ def self.down
+ ForgotPasswordPage.destroy_all
+ end
+end
@@ -19,4 +19,11 @@ Feature: Account
And I fill in "gibberish" for "Email"
And I press "Save"
Then "Aslak"'s Email should be "aslak@test.com"
- And I should see "The Email address should look like an email address."
+ And I should see "The Email address should look like an email address."
+
+ Scenario: Receive reset password email
+ Given an "active" site_user named "Aslak" exists
+ When I view the forgot password page
+ And I fill in "aslak@test.com" for "Email"
+ And I press "Send me a reset link"
+ Then "aslak@test.com" should receive an email with reset code/
@@ -29,3 +29,6 @@
visits "/account"
end
+When /I view the forgot password page/ do
+ visits "/forgot"
+end
@@ -24,6 +24,7 @@ namespace :db do
LoginPage.create!(:layout => layout)
AccountPage.create!(:layout => layout)
+ ForgotPasswordPage.create!(:layout => layout)
end
end
end

0 comments on commit 284aaf9

Please sign in to comment.