fingerrails 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fingerrails}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Manfred Stienstra", "Eloy Duran"]
12
- s.date = %q{2009-10-29}
12
+ s.date = %q{2009-11-02}
13
13
  s.default_executable = %q{fingerrails}
14
14
  s.description = %q{A self contained version of the Fingertips Rails template}
15
15
  s.email = %q{eloy@fngtps.com}
@@ -88,4 +88,3 @@ Gem::Specification.new do |s|
88
88
  else
89
89
  end
90
90
  end
91
-
@@ -13,7 +13,6 @@ class SessionsController < ApplicationController
13
13
  finish_authentication_needed! || redirect_to(root_url)
14
14
  else
15
15
  still_authentication_needed!
16
- flash[:login_error] = @unauthenticated.errors.on(:base)
17
16
  render :new
18
17
  end
19
18
  end
@@ -20,12 +20,13 @@ class Member
20
20
  ::Digest::SHA1.hexdigest(password)
21
21
  end
22
22
 
23
- # Authenticates credentials. Takes a hash with a :email and :password, returns an instance of Member.
24
- # The Member has errors on base when the user isn't authenticated.
23
+ # Authenticates credentials. Takes a hash with a :email and :password,
24
+ # returns an instance of Member. The Member has errors on base when
25
+ # the user isn't authenticated.
25
26
  def self.authenticate(params={})
26
27
  unless member = find_by_email_and_hashed_password(params[:email], hash_password(params[:password]))
27
- member = Member.new
28
- member.errors.add_to_base("The username and/or email you entered is invalid. Please try again.")
28
+ member = Member.new(params.slice(:email, :password))
29
+ member.errors.add_to_base("The credentials you entered are invalid. Please try again.")
29
30
  member
30
31
  else
31
32
  member
@@ -1,8 +1,8 @@
1
1
  <% form_for(@unauthenticated || Member.new, :url => session_path) do |f| %>
2
2
  <h2><%=h @title = 'Log in' %></h2>
3
3
 
4
- <% if flash[:login_error] %>
5
- <div class="errorExplanation"><%= flash[:login_error] %></div>
4
+ <% if @unauthenticated.errors.on(:base) %>
5
+ <div class="errorExplanation"><%= @unauthenticated.errors.on(:base) %></div>
6
6
  <% end %>
7
7
 
8
8
  <div class="field">
@@ -34,6 +34,12 @@ describe "On the", SessionsController, "a visitor" do
34
34
  assert_select 'div.errorExplanation'
35
35
  end
36
36
 
37
+ it "should not default the wrong password in the form after a failed login" do
38
+ post :create, :member => valid_credentials.merge(:password => 'wrong')
39
+ assert_select 'input[id="member_password"]'
40
+ assert_select 'input[id="member_password"][value]', false
41
+ end
42
+
37
43
  it "should see an explanation when the email does not exist" do
38
44
  post :create, :member => valid_credentials.merge(:email => 'unknown@example.com')
39
45
  should.not.be.authenticated
@@ -41,6 +47,11 @@ describe "On the", SessionsController, "a visitor" do
41
47
  assert_select 'div.errorExplanation'
42
48
  end
43
49
 
50
+ it "should default the email in the form after a failed login" do
51
+ post :create, :member => valid_credentials.merge(:email => 'unknown@example.com')
52
+ assert_select 'input[id="member_email"][value="unknown@example.com"]'
53
+ end
54
+
44
55
  it "should keep the url to return to if the password or email was wrong" do
45
56
  url = member_url(members(:adrian))
46
57
  post :create, { :member => valid_credentials.merge(:password => 'wrong') }, {}, { :after_authentication => { :redirect_to => url }}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fingerrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-10-29 00:00:00 +01:00
13
+ date: 2009-11-02 00:00:00 +01:00
14
14
  default_executable: fingerrails
15
15
  dependencies: []
16
16