Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove dependency on dynamic_form. Replaced with flashes due to limit…

…ed number of failure cases. Resolves #145.
  • Loading branch information...
commit 04b2363dbf0bf65d52dedb30695aa719fe4312c3 1 parent cb3f69c
@croaky croaky authored
View
23 CHANGELOG.md
@@ -1,15 +1,16 @@
0.11.1 (unreleased)
-------------------
-* Redirect to home page after sign up.
+* Redirect to home page after sign up. #146 (Dan Croak)
+* Remove dependency on dynamic_form. Replaced with flashes due to limited number of failure cases. #145 (Dan Croak)
0.11.0
-------------------
-* Removing password confirmation.
-* Use ActiveSupport::Concern and ActiveSupport::SecureRandom to clean up code.
-* New controller#authenticate(params) method. Redefine username & password or other styles of authentication.
-* before_filter :authenticate API replaced with more aptly-named before_filter :authorize.
+* Removing password confirmation. (Dan Croak)
+* Use ActiveSupport::Concern and ActiveSupport::SecureRandom to clean up code. (Dan Croak)
+* New controller#authenticate(params) method. Redefine username & password or other styles of authentication. (Dan Croak)
+* before_filter :authenticate API replaced with more aptly-named before_filter :authorize. (Dan Croak)
0.10.5
-------------------
@@ -19,11 +20,11 @@
0.10.4
------------------
-* Formtastic views generator removed.
+* Formtastic views generator removed. (Dan Croak)
* Emails forced to be downcased (particularly for iPhone user case). (Adam Conrad)
* Suite converted from test/unit to RSpec. (Joe Ferris)
* Password reset requires a password. (Joel Meador)
-* Use HTML5 email fields.
+* Use HTML5 email fields. (Dan Croak)
0.10.3.2
------------------
@@ -46,14 +47,14 @@
* Replaced test/rails_root & general testing strategy with Diesel. (Joe Ferris)
* Conveniences in factories for password/confirmation.
* New generator command: rails generate clearance:install.
-* Step definitions are now prefixed with visitor_ to use thoughtbot convention.
+* Step definitions are now prefixed with visitor_ to use thoughtbot convention. (Dan Croak)
* When Clearance installed in an app that already has users, allow old users to sign in by resetting their password.
0.10.1
------------------
-* replaced ActionController::Forbidden with a user-friendly flash message.
-* improved language of Cucumber steps by allowing a little more flexibility.
+* replaced ActionController::Forbidden with a user-friendly flash message. (Dan Croak)
+* improved language of Cucumber steps by allowing a little more flexibility. (Dan Croak)
0.10.0
------------------
@@ -67,7 +68,7 @@
https://github.com/rails/jquery-ujs/issues#issue/30
http://bugs.jquery.com/ticket/7061
-0.9.x
+0.9.1
------------------
Forgot to update the changelog in a while, this is going to be brief:
View
1  Gemfile
@@ -11,6 +11,5 @@ gem "cucumber-rails", '0.3.2'
gem "capybara"
gem "factory_girl_rails"
gem "rspec-rails"
-gem "dynamic_form"
gem "launchy"
gem "mocha"
View
2  Gemfile.lock
@@ -60,7 +60,6 @@ GEM
diesel (0.1.4)
railties (~> 3.0.3)
diff-lcs (1.1.2)
- dynamic_form (1.1.4)
erubis (2.6.6)
abstract (>= 1.0.0)
eventmachine (0.12.10)
@@ -147,7 +146,6 @@ DEPENDENCIES
capybara
cucumber-rails (= 0.3.2)
diesel
- dynamic_form
factory_girl
factory_girl_rails
launchy
View
7 app/controllers/clearance/passwords_controller.rb
@@ -36,6 +36,7 @@ def update
flash_success_after_update
redirect_to(url_after_update)
else
+ flash_failure_after_update
render :template => 'passwords/edit'
end
end
@@ -80,6 +81,12 @@ def flash_success_after_update
flash[:success] = translate(:signed_in, :default => "Signed in.")
end
+ def flash_failure_after_update
+ flash.now[:failure] = translate(:blank_password,
+ :scope => [:clearance, :controllers, :passwords],
+ :default => "Password can't be blank.")
+ end
+
def url_after_create
sign_in_url
end
View
13 app/controllers/clearance/users_controller.rb
@@ -1,8 +1,8 @@
class Clearance::UsersController < ApplicationController
unloadable
- skip_before_filter :authorize, :only => [:new, :create]
- before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in?
+ skip_before_filter :authorize, :only => [:new, :create]
+ before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in?
def new
@user = ::User.new(params[:user])
@@ -12,10 +12,11 @@ def new
def create
@user = ::User.new(params[:user])
if @user.save
- flash_notice_after_create
sign_in(@user)
+ flash_notice_after_create
redirect_to(url_after_create)
else
+ flash_failure_after_create
render :template => 'users/new'
end
end
@@ -28,6 +29,12 @@ def flash_notice_after_create
:default => "You are now signed up.")
end
+ def flash_failure_after_create
+ flash.now[:failure] = translate(:bad_email_or_password,
+ :scope => [:clearance, :controllers, :passwords],
+ :default => "Must be a valid email address. Password can't be blank.")
+ end
+
def url_after_create
'/'
end
View
1  app/views/passwords/edit.html.erb
@@ -7,7 +7,6 @@
<%= form_for(:user,
:url => user_password_path(@user, :token => @user.confirmation_token),
:html => { :method => :put }) do |form| %>
- <%= form.error_messages %>
<div class="password_field">
<%= form.label :password, "Choose password" %>
<%= form.password_field :password %>
View
1  app/views/users/_form.html.erb
@@ -1,4 +1,3 @@
-<%= form.error_messages %>
<div class="text_field">
<%= form.label :email %>
<%= form.text_field :email, :type => "email" %>
View
2  features/engine/visitor_resets_password.feature
@@ -23,7 +23,7 @@ Feature: Password reset
And I press "Reset password"
When I follow the password reset link sent to "email@example.com"
And I update my password with ""
- Then I should see an error message
+ Then I should see "Password can't be blank."
And I should be signed out
Scenario: User is signed up and updates his password
View
4 features/engine/visitor_signs_up.feature
@@ -1,6 +1,6 @@
Feature: Sign up
- In order to get access to protected sections of the site
+ In order to access protected sections of the site
As a visitor
I want to sign up
@@ -12,7 +12,7 @@ Feature: Sign up
When I fill in "Email" with "invalidemail"
And I fill in "Password" with "password"
And I press "Sign up"
- Then I should see "Email is invalid"
+ Then I should see "Must be a valid email address"
Scenario: Visitor signs up with blank password
When I fill in "Email" with "email@example.com"
View
2  spec/controllers/passwords_controller_spec.rb
@@ -154,7 +154,7 @@
cookies[:remember_token].should be_nil
end
- it { should_not set_the_flash }
+ it { should set_the_flash.to(/password can't be blank/i) }
it { should respond_with(:success) }
it { should render_template(:edit) }
end
Please sign in to comment.
Something went wrong with that request. Please try again.