authpwn_rails 0.4.1 → 0.4.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/README.rdoc +13 -2
- data/VERSION +1 -1
- data/app/controllers/session_controller.rb +6 -0
- data/authpwn_rails.gemspec +3 -2
- data/lib/authpwn_rails/generators/session_views_generator.rb +2 -0
- data/lib/authpwn_rails/generators/templates/session/home.html.erb +2 -1
- data/lib/authpwn_rails/generators/templates/session/new.html.erb +17 -0
- data/lib/authpwn_rails/generators/templates/session/welcome.html.erb +2 -1
- data/test/session_controller_test.rb +19 -0
- data/test/test_helper.rb +2 -1
- metadata +5 -4
data/README.rdoc
CHANGED
@@ -4,8 +4,19 @@ User authentication for a Ruby on Rails 3 application. Works with Facebook.
|
|
4
4
|
|
5
5
|
== Integration
|
6
6
|
|
7
|
-
|
8
|
-
rails g authpwn_rails
|
7
|
+
Scaffold user accounts, session controller views, and Facebook extensions.
|
8
|
+
rails g authpwn_rails:users
|
9
|
+
rails g authpwn_rails:session_views
|
10
|
+
rails g authpwn_rails:facebook
|
11
|
+
|
12
|
+
Wire authentication into your ApplicationController.
|
13
|
+
authenticates_using_session
|
14
|
+
authenticates_using_facebook_token
|
15
|
+
|
16
|
+
|
17
|
+
Note: the code inside the models and controllers is tucked away in the plug-in.
|
18
|
+
The scaffold models and controllers are there as extension points. You will be
|
19
|
+
able to update the plug-in without regenerating the scaffolds.
|
9
20
|
|
10
21
|
== Note on Patches/Pull Requests
|
11
22
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/authpwn_rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{authpwn_rails}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Victor Costan"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-06}
|
13
13
|
s.description = %q{Works with Facebook.}
|
14
14
|
s.email = %q{victor@costan.us}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
"lib/authpwn_rails/generators/templates/facebook_token.rb",
|
39
39
|
"lib/authpwn_rails/generators/templates/facebook_tokens.yml",
|
40
40
|
"lib/authpwn_rails/generators/templates/session/home.html.erb",
|
41
|
+
"lib/authpwn_rails/generators/templates/session/new.html.erb",
|
41
42
|
"lib/authpwn_rails/generators/templates/session/welcome.html.erb",
|
42
43
|
"lib/authpwn_rails/generators/templates/user.rb",
|
43
44
|
"lib/authpwn_rails/generators/templates/users.yml",
|
@@ -8,6 +8,8 @@ class SessionViewsGenerator < Rails::Generators::Base
|
|
8
8
|
def create_session_views
|
9
9
|
copy_file File.join('session', 'home.html.erb'),
|
10
10
|
File.join('app', 'views', 'session', 'home.html.erb')
|
11
|
+
copy_file File.join('session', 'new.html.erb'),
|
12
|
+
File.join('app', 'views', 'session', 'new.html.erb')
|
11
13
|
copy_file File.join('session', 'welcome.html.erb'),
|
12
14
|
File.join('app', 'views', 'session', 'welcome.html.erb')
|
13
15
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<p>This is a sample login form. You should customize it for your users.</p>
|
2
|
+
|
3
|
+
<%= form_for User.new, :url => session_path do |f| %>
|
4
|
+
<div class="field">
|
5
|
+
<%= f.label :email, 'Email Address' %><br />
|
6
|
+
<%= f.text_field :email %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<%= f.label :password %><br />
|
11
|
+
<%= f.password_field :password %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="actions">
|
15
|
+
<%= f.submit 'Log in' %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
@@ -20,6 +20,25 @@ class SessionControllerTest < ActionController::TestCase
|
|
20
20
|
assert_equal @user, assigns(:current_user)
|
21
21
|
end
|
22
22
|
|
23
|
+
test "new redirects homes with a user" do
|
24
|
+
set_session_current_user @user
|
25
|
+
get :new
|
26
|
+
assert_redirected_to session_url
|
27
|
+
end
|
28
|
+
|
29
|
+
test "new renders login form without a user" do
|
30
|
+
get :new
|
31
|
+
assert_template :new
|
32
|
+
assert_nil assigns(:current_user), 'current_user should not be set'
|
33
|
+
assert assigns(:user).new_record?, 'user instance variable should be fresh'
|
34
|
+
|
35
|
+
assert_select 'form' do
|
36
|
+
assert_select 'input#user_email'
|
37
|
+
assert_select 'input#user_password'
|
38
|
+
assert_select 'input[type=submit]'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
23
42
|
test "create logs in with good account details" do
|
24
43
|
post :create, :user => { :email => @user.email, :password => 'password' }
|
25
44
|
assert_redirected_to session_url
|
data/test/test_helper.rb
CHANGED
@@ -11,8 +11,9 @@ require 'sqlite3'
|
|
11
11
|
|
12
12
|
require 'authpwn_rails'
|
13
13
|
|
14
|
+
require 'helpers/view_helpers.rb'
|
15
|
+
# NOTE: application_controller has to follow view_helpers
|
14
16
|
require 'helpers/application_controller.rb'
|
15
17
|
require 'helpers/db_setup.rb'
|
16
18
|
require 'helpers/fbgraph.rb'
|
17
19
|
require 'helpers/routes.rb'
|
18
|
-
require 'helpers/view_helpers.rb'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authpwn_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Victor Costan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-06 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/authpwn_rails/generators/templates/facebook_token.rb
|
99
99
|
- lib/authpwn_rails/generators/templates/facebook_tokens.yml
|
100
100
|
- lib/authpwn_rails/generators/templates/session/home.html.erb
|
101
|
+
- lib/authpwn_rails/generators/templates/session/new.html.erb
|
101
102
|
- lib/authpwn_rails/generators/templates/session/welcome.html.erb
|
102
103
|
- lib/authpwn_rails/generators/templates/user.rb
|
103
104
|
- lib/authpwn_rails/generators/templates/users.yml
|