reflex 0.0.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.
Files changed (88) hide show
  1. data/.document +5 -0
  2. data/.gitignore +24 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +193 -0
  5. data/Rakefile +146 -0
  6. data/VERSION +1 -0
  7. data/cucumber.yml +7 -0
  8. data/features/connect_to_provider.feature +18 -0
  9. data/features/social_authentication.feature +50 -0
  10. data/features/step_definitions/reflex_steps.rb +93 -0
  11. data/features/step_definitions/web_steps.rb +192 -0
  12. data/features/support/env.rb +57 -0
  13. data/features/support/mocha.rb +16 -0
  14. data/features/support/mock_controller/oauth_authorize.html.erb +15 -0
  15. data/features/support/mocks.rb +21 -0
  16. data/features/support/paths.rb +39 -0
  17. data/features/support/rails_root/.gitignore +8 -0
  18. data/features/support/rails_root/Rakefile +10 -0
  19. data/features/support/rails_root/app/controllers/application_controller.rb +20 -0
  20. data/features/support/rails_root/app/controllers/user_sessions_controller.rb +24 -0
  21. data/features/support/rails_root/app/controllers/users_controller.rb +46 -0
  22. data/features/support/rails_root/app/helpers/application_helper.rb +3 -0
  23. data/features/support/rails_root/app/helpers/user_sessions_helper.rb +2 -0
  24. data/features/support/rails_root/app/helpers/users_helper.rb +2 -0
  25. data/features/support/rails_root/app/models/user.rb +7 -0
  26. data/features/support/rails_root/app/models/user_session.rb +2 -0
  27. data/features/support/rails_root/app/views/layouts/application.html.erb +23 -0
  28. data/features/support/rails_root/app/views/user_sessions/new.html.erb +23 -0
  29. data/features/support/rails_root/app/views/users/_form.html.erb +31 -0
  30. data/features/support/rails_root/app/views/users/_user.html.erb +1 -0
  31. data/features/support/rails_root/app/views/users/edit.html.erb +2 -0
  32. data/features/support/rails_root/app/views/users/index.html.erb +8 -0
  33. data/features/support/rails_root/app/views/users/new.html.erb +2 -0
  34. data/features/support/rails_root/app/views/users/show.html.erb +20 -0
  35. data/features/support/rails_root/config/boot.rb +110 -0
  36. data/features/support/rails_root/config/database.yml +9 -0
  37. data/features/support/rails_root/config/environment.rb +22 -0
  38. data/features/support/rails_root/config/environments/development.rb +0 -0
  39. data/features/support/rails_root/config/environments/test.rb +0 -0
  40. data/features/support/rails_root/config/initializers/backtrace_silencers.rb +7 -0
  41. data/features/support/rails_root/config/initializers/inflections.rb +10 -0
  42. data/features/support/rails_root/config/initializers/mime_types.rb +5 -0
  43. data/features/support/rails_root/config/initializers/new_rails_defaults.rb +21 -0
  44. data/features/support/rails_root/config/initializers/session_store.rb +15 -0
  45. data/features/support/rails_root/config/routes.rb +9 -0
  46. data/features/support/rails_root/db/migrate/001_create_users.rb +16 -0
  47. data/features/support/rails_root/db/migrate/002_create_reflex_connections.rb +17 -0
  48. data/features/support/rails_root/db/schema.rb +35 -0
  49. data/features/support/rails_root/vendor/plugins/reflex/rails/init.rb +1 -0
  50. data/features/traditional_registration_and_authentication.feature +39 -0
  51. data/init.rb +5 -0
  52. data/lib/reflex/authlogic/account.rb +55 -0
  53. data/lib/reflex/authlogic/acts_as_authentic.rb +19 -0
  54. data/lib/reflex/authlogic/authentication_process.rb +40 -0
  55. data/lib/reflex/authlogic/callback_filter.rb +26 -0
  56. data/lib/reflex/authlogic/connectable.rb +87 -0
  57. data/lib/reflex/authlogic/connection.rb +18 -0
  58. data/lib/reflex/authlogic/session.rb +84 -0
  59. data/lib/reflex/base.rb +37 -0
  60. data/lib/reflex/configuration.rb +38 -0
  61. data/lib/reflex/oauth_server.rb +47 -0
  62. data/lib/reflex/system.rb +25 -0
  63. data/lib/reflex.rb +14 -0
  64. data/rails/init.rb +22 -0
  65. data/rails_generators/reflex_connection_migration/reflex_connection_migration_generator.rb +12 -0
  66. data/rails_generators/reflex_connection_migration/templates/create_reflex_connections.rb +17 -0
  67. data/reflex.gemspec +164 -0
  68. data/spec/fakeweb/OAuthServer.getProviders +5 -0
  69. data/spec/fakeweb/OAuthServer.sessionGetProfile +5 -0
  70. data/spec/fakeweb/OAuthServer.tokenAccess +4 -0
  71. data/spec/fakeweb/OAuthServer.tokenRequest +5 -0
  72. data/spec/fakeweb/OAuthServer.tokenSetUserId +5 -0
  73. data/spec/fakeweb/OAuthServer.userGetProfile +5 -0
  74. data/spec/fakeweb/OAuthServer.userGetProviders +4 -0
  75. data/spec/fakeweb/OAuthServer.userRemoveProvider +5 -0
  76. data/spec/fakeweb/System.listMethods +5 -0
  77. data/spec/fakeweb/System.methodDescription +5 -0
  78. data/spec/fakeweb/System.methodSignature +5 -0
  79. data/spec/reflex/authlogic/connection_spec.rb +22 -0
  80. data/spec/reflex/base_spec.rb +29 -0
  81. data/spec/reflex/configuration_spec.rb +71 -0
  82. data/spec/reflex/oauth_server_spec.rb +219 -0
  83. data/spec/reflex/system_spec.rb +83 -0
  84. data/spec/reflex_spec.rb +5 -0
  85. data/spec/schema.rb +15 -0
  86. data/spec/spec.opts +1 -0
  87. data/spec/spec_helper.rb +66 -0
  88. metadata +294 -0
@@ -0,0 +1,192 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ require 'uri'
9
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
10
+
11
+ module WithinHelpers
12
+ def with_scope(locator)
13
+ locator ? within(locator) { yield } : yield
14
+ end
15
+ end
16
+ World(WithinHelpers)
17
+
18
+ Given /^(?:|I )am on (.+)$/ do |page_name|
19
+ visit path_to(page_name)
20
+ end
21
+
22
+ When /^(?:|I )go to (.+)$/ do |page_name|
23
+ visit path_to(page_name)
24
+ end
25
+
26
+ When /^(?:|I )press "([^\"]*)"(?: within "([^\"]*)")?$/ do |button, selector|
27
+ with_scope(selector) do
28
+ click_button(button)
29
+ end
30
+ end
31
+
32
+ When /^(?:|I )follow "([^\"]*)"(?: within "([^\"]*)")?$/ do |link, selector|
33
+ with_scope(selector) do
34
+ click_link(link)
35
+ end
36
+ end
37
+
38
+ When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, value, selector|
39
+ with_scope(selector) do
40
+ fill_in(field, :with => value)
41
+ end
42
+ end
43
+
44
+ When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
45
+ with_scope(selector) do
46
+ fill_in(field, :with => value)
47
+ end
48
+ end
49
+
50
+ # Use this to fill in an entire form with data from a table. Example:
51
+ #
52
+ # When I fill in the following:
53
+ # | Account Number | 5002 |
54
+ # | Expiry date | 2009-11-01 |
55
+ # | Note | Nice guy |
56
+ # | Wants Email? | |
57
+ #
58
+ # TODO: Add support for checkbox, select og option
59
+ # based on naming conventions.
60
+ #
61
+ When /^(?:|I )fill in the following(?: within "([^\"]*)")?:$/ do |selector, fields|
62
+ with_scope(selector) do
63
+ fields.rows_hash.each do |name, value|
64
+ When %{I fill in "#{name}" with "#{value}"}
65
+ end
66
+ end
67
+ end
68
+
69
+ When /^(?:|I )select "([^\"]*)" from "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
70
+ with_scope(selector) do
71
+ select(value, :from => field)
72
+ end
73
+ end
74
+
75
+ When /^(?:|I )check "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
76
+ with_scope(selector) do
77
+ check(field)
78
+ end
79
+ end
80
+
81
+ When /^(?:|I )uncheck "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
82
+ with_scope(selector) do
83
+ uncheck(field)
84
+ end
85
+ end
86
+
87
+ When /^(?:|I )choose "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
88
+ with_scope(selector) do
89
+ choose(field)
90
+ end
91
+ end
92
+
93
+ When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"(?: within "([^\"]*)")?$/ do |path, field, selector|
94
+ with_scope(selector) do
95
+ attach_file(field, path)
96
+ end
97
+ end
98
+
99
+ Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
100
+ with_scope(selector) do
101
+ if defined?(Spec::Rails::Matchers)
102
+ page.should have_content(text)
103
+ else
104
+ assert page.has_content?(text)
105
+ end
106
+ end
107
+ end
108
+
109
+ Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
110
+ regexp = Regexp.new(regexp)
111
+ with_scope(selector) do
112
+ if defined?(Spec::Rails::Matchers)
113
+ page.should have_xpath('//*', :text => regexp)
114
+ else
115
+ assert page.has_xpath?('//*', :text => regexp)
116
+ end
117
+ end
118
+ end
119
+
120
+ Then /^(?:|I )should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
121
+ with_scope(selector) do
122
+ if defined?(Spec::Rails::Matchers)
123
+ page.should have_no_content(text)
124
+ else
125
+ assert page.has_no_content?(text)
126
+ end
127
+ end
128
+ end
129
+
130
+ Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
131
+ regexp = Regexp.new(regexp)
132
+ with_scope(selector) do
133
+ if defined?(Spec::Rails::Matchers)
134
+ page.shoul have_not_xpath('//*', :text => regexp)
135
+ else
136
+ assert page.has_not_xpath?('//*', :text => regexp)
137
+ end
138
+ end
139
+ end
140
+
141
+ Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain "([^\"]*)"$/ do |field, selector, value|
142
+ with_scope(selector) do
143
+ if defined?(Spec::Rails::Matchers)
144
+ find_field(field).value.should =~ /#{value}/
145
+ else
146
+ assert_match(/#{value}/, field_labeled(field).value)
147
+ end
148
+ end
149
+ end
150
+
151
+ Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should not contain "([^\"]*)"$/ do |field, selector, value|
152
+ with_scope(selector) do
153
+ if defined?(Spec::Rails::Matchers)
154
+ find_field(field).value.should_not =~ /#{value}/
155
+ else
156
+ assert_no_match(/#{value}/, find_field(field).value)
157
+ end
158
+ end
159
+ end
160
+
161
+ Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should be checked$/ do |label, selector|
162
+ with_scope(selector) do
163
+ if defined?(Spec::Rails::Matchers)
164
+ find_field(label)['checked'].should == 'checked'
165
+ else
166
+ assert field_labeled(label)['checked'] == 'checked'
167
+ end
168
+ end
169
+ end
170
+
171
+ Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should not be checked$/ do |label, selector|
172
+ with_scope(selector) do
173
+ if defined?(Spec::Rails::Matchers)
174
+ find_field(label)['checked'].should_not == 'checked'
175
+ else
176
+ assert field_labeled(label)['checked'] != 'checked'
177
+ end
178
+ end
179
+ end
180
+
181
+ Then /^(?:|I )should be on (.+)$/ do |page_name|
182
+ current_path = URI.parse(current_url).select(:path, :query).compact.join('?')
183
+ if defined?(Spec::Rails::Matchers)
184
+ current_path.should == path_to(page_name)
185
+ else
186
+ assert_equal path_to(page_name), current_path
187
+ end
188
+ end
189
+
190
+ Then /^show me the page$/ do
191
+ save_and_open_page
192
+ end
@@ -0,0 +1,57 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+ ENV["RAILS_ENV"] = "test"
7
+
8
+ $:.unshift(File.dirname(__FILE__) + '/rails_root/')
9
+ require File.expand_path(File.dirname(__FILE__) + '/rails_root/config/environment')
10
+
11
+ require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
12
+ require 'cucumber/rails/rspec'
13
+ require 'cucumber/rails/world'
14
+ require 'cucumber/rails/active_record'
15
+ require 'cucumber/web/tableish'
16
+
17
+ require 'capybara/rails'
18
+ require 'capybara/cucumber'
19
+ require 'capybara/session'
20
+ require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
21
+
22
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
23
+ # order to ease the transition to Capybara we set the default here. If you'd
24
+ # prefer to use XPath just remove this line and adjust any selectors in your
25
+ # steps to use the XPath syntax.
26
+ Capybara.default_selector = :css
27
+
28
+ # If you set this to false, any error raised from within your app will bubble
29
+ # up to your step definition and out to cucumber unless you catch it somewhere
30
+ # on the way. You can make Rails rescue errors and render error pages on a
31
+ # per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
32
+ #
33
+ # If you set this to true, Rails will rescue all errors and render error
34
+ # pages, more or less in the same way your application would behave in the
35
+ # default production environment. It's not recommended to do this for all
36
+ # of your scenarios, as this makes it hard to discover errors in your application.
37
+ ActionController::Base.allow_rescue = false
38
+
39
+ # If you set this to true, each scenario will run in a database transaction.
40
+ # You can still turn off transactions on a per-scenario basis, simply tagging
41
+ # a feature or scenario with the @no-txn tag. If you are using Capybara,
42
+ # tagging with @culerity or @javascript will also turn transactions off.
43
+ #
44
+ # If you set this to false, transactions will be off for all scenarios,
45
+ # regardless of whether you use @no-txn or not.
46
+ #
47
+ # Beware that turning transactions off will leave data in your database
48
+ # after each scenario, which can lead to hard-to-debug failures in
49
+ # subsequent scenarios. If you do this, we recommend you create a Before
50
+ # block that will explicitly put your database in a known state.
51
+ Cucumber::Rails::World.use_transactional_fixtures = true
52
+
53
+ # How to clean your database when transactions are turned off. See
54
+ # http://github.com/bmabey/database_cleaner for more info.
55
+ require 'database_cleaner'
56
+ DatabaseCleaner.strategy = :truncation
57
+
@@ -0,0 +1,16 @@
1
+ require 'spec/stubs/cucumber'
2
+ require 'mocha'
3
+
4
+ World(Mocha::API)
5
+
6
+ Before do
7
+ mocha_setup
8
+ end
9
+
10
+ After do
11
+ begin
12
+ mocha_verify
13
+ ensure
14
+ mocha_teardown
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Fake Twitter OAuth</title>
5
+ </head>
6
+ <body>
7
+ <!-- Do a GET request, because our middleware should fake it into being a POST request -->
8
+ <form action="/user_sessions?ReactOAuthSession=FAKE_OAUTH_TOKEN" method="get">
9
+ <fieldset>
10
+ <input type="submit" value="Deny" name="deny">
11
+ <input type="submit" value="Allow" name="allow">
12
+ </fieldset>
13
+ </form>
14
+ </body>
15
+ </html>
@@ -0,0 +1,21 @@
1
+ class MockController < ActionController::Base
2
+ def oauth_authorize
3
+ render_fake('oauth_authorize.html.erb')
4
+ end
5
+
6
+ private
7
+
8
+ def render_fake(template)
9
+ render :template => File.join(File.dirname(__FILE__), 'mock_controller', template)
10
+ end
11
+ end
12
+
13
+ ActionController::Routing::Routes.draw do |map|
14
+ map.with_options :controller => 'mock' do |fake|
15
+ fake.oauth_authorize 'fake_controller/oauth/authorize', :action => 'oauth_authorize'
16
+ end
17
+ end
18
+
19
+ Before do
20
+ Reflex::OAuthServer.stubs(:get_providers).returns(['Twitter', 'Facebook'])
21
+ end
@@ -0,0 +1,39 @@
1
+ module NavigationHelpers
2
+ # Maps a name to a path. Used by the
3
+ #
4
+ # When /^I go to (.+)$/ do |page_name|
5
+ #
6
+ # step definition in web_steps.rb
7
+ #
8
+ def path_to(page_name)
9
+ case page_name
10
+
11
+ when /the home\s?page/
12
+ '/'
13
+
14
+ when /the users page/
15
+ users_path
16
+
17
+ when /the user page for "([^"]+)"/
18
+ user_path(User.find_by_login($1))
19
+
20
+ when /the login page/
21
+ login_path
22
+
23
+ when /my profile/
24
+ user_path(User.last)
25
+
26
+ # Add more mappings here.
27
+ # Here is an example that pulls values out of the Regexp:
28
+ #
29
+ # when /^(.*)'s profile page$/i
30
+ # user_profile_path(User.find_by_login($1))
31
+
32
+ else
33
+ raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
34
+ "Now, go and add a mapping in #{__FILE__}"
35
+ end
36
+ end
37
+ end
38
+
39
+ World(NavigationHelpers)
@@ -0,0 +1,8 @@
1
+ log/
2
+ tmp/**/*
3
+ db/*.sqlite3
4
+ public/system
5
+ *.DS_Store
6
+ coverage/*
7
+ *.swp
8
+ public/
@@ -0,0 +1,10 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+
10
+ require 'tasks/rails'
@@ -0,0 +1,20 @@
1
+ # Filters added to this controller apply to all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+
4
+ class ApplicationController < ActionController::Base
5
+ helper :all # include all helpers, all the time
6
+ helper_method :current_user_session, :current_user
7
+ filter_parameter_logging :password, :password_confirmation
8
+
9
+ private
10
+
11
+ def current_user_session
12
+ return @current_user_session if defined?(@current_user_session)
13
+ @current_user_session = UserSession.find
14
+ end
15
+
16
+ def current_user
17
+ return @current_user if defined?(@current_user)
18
+ @current_user = current_user_session && current_user_session.record
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ class UserSessionsController < ApplicationController
2
+ def new
3
+ @user_session = UserSession.new
4
+ end
5
+
6
+ def create
7
+ @user_session = UserSession.new(params[:user_session])
8
+
9
+ @user_session.save do |success|
10
+ if success
11
+ flash[:notice] = "Login successful!"
12
+ redirect_to @user_session.record
13
+ else
14
+ render :action => :new
15
+ end
16
+ end
17
+ end
18
+
19
+ def destroy
20
+ current_user_session.destroy
21
+ flash[:notice] = "Logout successful!"
22
+ redirect_to root_path
23
+ end
24
+ end
@@ -0,0 +1,46 @@
1
+ class UsersController < ApplicationController
2
+ def index
3
+ @users = User.all
4
+ end
5
+
6
+ def show
7
+ @user = User.find(params[:id])
8
+ end
9
+
10
+ def new
11
+ @user = User.new
12
+ end
13
+
14
+ def create
15
+ @user = User.create(params[:user])
16
+
17
+ if @user.valid?
18
+ flash[:notice] = "Succesfully created a new user"
19
+ redirect_to users_path
20
+ else
21
+ render :action => :new
22
+ end
23
+ end
24
+
25
+ def edit
26
+ @user = User.find(params[:id])
27
+ end
28
+
29
+ def update
30
+ @user = User.find(params[:id])
31
+
32
+ if @user.update_attributes(params[:user])
33
+ flash[:notice] = "Succesfully updated user"
34
+ redirect_to(@user)
35
+ else
36
+ render :action => :edit
37
+ end
38
+ end
39
+
40
+ def destroy
41
+ @user = User.find(params[:id])
42
+ @user.destroy
43
+
44
+ redirect_to users_url
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,2 @@
1
+ module UserSessionsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+ acts_as_authentic
3
+
4
+ def react_profile=(profile)
5
+ self.name = profile['real_name'] || profile['user_name']
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ class UserSession < Authlogic::Session::Base
2
+ end
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Reflex</title>
5
+ </head>
6
+ <body>
7
+ <nav>
8
+ <% if current_user %>
9
+ <%= link_to 'My Profile', current_user %> |
10
+ <%= link_to 'Logout', logout_path %>
11
+ <% else %>
12
+ <%= link_to 'Login', login_path %> |
13
+ <%= link_to 'Register', new_user_path %>
14
+ <% end %>
15
+ </nav>
16
+
17
+ <% flash.each do |type, message| %>
18
+ <p><%= type.to_s.upcase %>: <%= message %></p>
19
+ <% end %>
20
+
21
+ <%= yield %>
22
+ </body>
23
+ </html>
@@ -0,0 +1,23 @@
1
+ <h1>Log in</h1>
2
+ <% form_for(@user_session) do |f| %>
3
+ <div class="left">
4
+ <h2>Log in with your account</h2>
5
+ <p>
6
+ <%= f.label :login %>
7
+ <br>
8
+ <%= f.text_field :login %>
9
+ </p>
10
+ <p>
11
+ <%= f.label :password %>
12
+ <br>
13
+ <%= f.password_field :password %>
14
+ </p>
15
+ <p><%= f.submit "Login" %></p>
16
+ </div>
17
+ <div class="right">
18
+ <h2>Or log in via:</h2>
19
+ <% Reflex::OAuthServer.get_providers.each do |provider| %>
20
+ <%= f.submit provider, :name => "react_provider" %>
21
+ <% end %>
22
+ </div>
23
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <% form_for(@user) do |f| %>
2
+ <%= f.error_messages %>
3
+ <p>
4
+ <%= f.label :login %>
5
+ <br>
6
+ <%= f.text_field :login %>
7
+ </p>
8
+
9
+ <p>
10
+ <%= f.label :name %>
11
+ <br>
12
+ <%= f.text_field :name %>
13
+ </p>
14
+
15
+ <p>
16
+ <%= f.label :password %>
17
+ <br>
18
+ <%= f.password_field :password %>
19
+ <%= f.password_field :password_confirmation %>
20
+ </p>
21
+
22
+ <p>
23
+ <%= f.label :connect_to_provider %>
24
+ <br>
25
+ <% Reflex::OAuthServer.get_providers.each do |provider| %>
26
+ <%= f.submit provider, :name => "react_provider" %>
27
+ <% end %>
28
+ </p>
29
+
30
+ <p><%= f.submit "Save" %></p>
31
+ <% end %>
@@ -0,0 +1 @@
1
+ <li><%= link_to user.name, @user %></li>
@@ -0,0 +1,2 @@
1
+ <h1>Edit a user</h1>
2
+ <%= render :partial => "form" %>
@@ -0,0 +1,8 @@
1
+ <h1>User overview</h1>
2
+ <% if @users.present? %>
3
+ <ul>
4
+ <%= render @users %>
5
+ </ul>
6
+ <% else %>
7
+ <p>No users found.</p>
8
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h1>Create a user</h1>
2
+ <%= render :partial => "form" %>
@@ -0,0 +1,20 @@
1
+ <h1>User</h1>
2
+ <dl>
3
+ <dt>Login</dt>
4
+ <dd><%= @user.login %></dd>
5
+ <dt>Name</dt>
6
+ <dd><%= @user.name %></dd>
7
+ </dl>
8
+
9
+ <% if @user.reflex_connections.present? %>
10
+ <h2>Connected providers:</h2>
11
+ <ul>
12
+ <% @user.reflex_connections.each do |connection| %>
13
+ <li><%= connection.provider %></li>
14
+ <% end %>
15
+ </ul>
16
+ <% end %>
17
+
18
+ <% if current_user == @user %>
19
+ <p><%= link_to "Edit my profile", edit_user_path(@user) %>
20
+ <% end %>