namxam-devise 1.1.0.win

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/CHANGELOG.rdoc +455 -0
  2. data/Gemfile +23 -0
  3. data/Gemfile.lock +118 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.rdoc +311 -0
  6. data/Rakefile +55 -0
  7. data/TODO +3 -0
  8. data/app/controllers/devise/confirmations_controller.rb +33 -0
  9. data/app/controllers/devise/passwords_controller.rb +41 -0
  10. data/app/controllers/devise/registrations_controller.rb +57 -0
  11. data/app/controllers/devise/sessions_controller.rb +23 -0
  12. data/app/controllers/devise/unlocks_controller.rb +34 -0
  13. data/app/helpers/devise_helper.rb +17 -0
  14. data/app/mailers/devise/mailer.rb +71 -0
  15. data/app/views/devise/confirmations/new.html.erb +12 -0
  16. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  17. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  18. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  19. data/app/views/devise/passwords/edit.html.erb +16 -0
  20. data/app/views/devise/passwords/new.html.erb +12 -0
  21. data/app/views/devise/registrations/edit.html.erb +25 -0
  22. data/app/views/devise/registrations/new.html.erb +18 -0
  23. data/app/views/devise/sessions/new.html.erb +17 -0
  24. data/app/views/devise/shared/_links.erb +19 -0
  25. data/app/views/devise/unlocks/new.html.erb +12 -0
  26. data/config/locales/en.yml +39 -0
  27. data/lib/devise.rb +290 -0
  28. data/lib/devise/controllers/helpers.rb +231 -0
  29. data/lib/devise/controllers/internal_helpers.rb +98 -0
  30. data/lib/devise/controllers/scoped_views.rb +35 -0
  31. data/lib/devise/controllers/url_helpers.rb +41 -0
  32. data/lib/devise/encryptors/authlogic_sha512.rb +19 -0
  33. data/lib/devise/encryptors/base.rb +20 -0
  34. data/lib/devise/encryptors/bcrypt.rb +19 -0
  35. data/lib/devise/encryptors/clearance_sha1.rb +17 -0
  36. data/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
  37. data/lib/devise/encryptors/sha1.rb +25 -0
  38. data/lib/devise/encryptors/sha512.rb +25 -0
  39. data/lib/devise/failure_app.rb +107 -0
  40. data/lib/devise/hooks/activatable.rb +11 -0
  41. data/lib/devise/hooks/forgetable.rb +11 -0
  42. data/lib/devise/hooks/rememberable.rb +35 -0
  43. data/lib/devise/hooks/timeoutable.rb +22 -0
  44. data/lib/devise/hooks/trackable.rb +9 -0
  45. data/lib/devise/mapping.rb +103 -0
  46. data/lib/devise/models.rb +80 -0
  47. data/lib/devise/models/authenticatable.rb +126 -0
  48. data/lib/devise/models/confirmable.rb +164 -0
  49. data/lib/devise/models/database_authenticatable.rb +110 -0
  50. data/lib/devise/models/lockable.rb +165 -0
  51. data/lib/devise/models/recoverable.rb +81 -0
  52. data/lib/devise/models/registerable.rb +8 -0
  53. data/lib/devise/models/rememberable.rb +104 -0
  54. data/lib/devise/models/timeoutable.rb +26 -0
  55. data/lib/devise/models/token_authenticatable.rb +60 -0
  56. data/lib/devise/models/trackable.rb +30 -0
  57. data/lib/devise/models/validatable.rb +53 -0
  58. data/lib/devise/modules.rb +23 -0
  59. data/lib/devise/orm/active_record.rb +36 -0
  60. data/lib/devise/orm/mongoid.rb +29 -0
  61. data/lib/devise/path_checker.rb +18 -0
  62. data/lib/devise/rails.rb +69 -0
  63. data/lib/devise/rails/routes.rb +248 -0
  64. data/lib/devise/rails/warden_compat.rb +39 -0
  65. data/lib/devise/schema.rb +97 -0
  66. data/lib/devise/strategies/authenticatable.rb +111 -0
  67. data/lib/devise/strategies/base.rb +33 -0
  68. data/lib/devise/strategies/database_authenticatable.rb +21 -0
  69. data/lib/devise/strategies/rememberable.rb +43 -0
  70. data/lib/devise/strategies/token_authenticatable.rb +49 -0
  71. data/lib/devise/test_helpers.rb +90 -0
  72. data/lib/devise/version.rb +3 -0
  73. data/lib/generators/active_record/devise_generator.rb +28 -0
  74. data/lib/generators/active_record/templates/migration.rb +29 -0
  75. data/lib/generators/devise/devise_generator.rb +17 -0
  76. data/lib/generators/devise/install_generator.rb +24 -0
  77. data/lib/generators/devise/orm_helpers.rb +23 -0
  78. data/lib/generators/devise/templates/README +25 -0
  79. data/lib/generators/devise/templates/devise.rb +139 -0
  80. data/lib/generators/devise/views_generator.rb +63 -0
  81. data/lib/generators/devise_install_generator.rb +4 -0
  82. data/lib/generators/devise_views_generator.rb +4 -0
  83. data/lib/generators/mongoid/devise_generator.rb +17 -0
  84. data/test/controllers/helpers_test.rb +213 -0
  85. data/test/controllers/internal_helpers_test.rb +51 -0
  86. data/test/controllers/url_helpers_test.rb +58 -0
  87. data/test/devise_test.rb +65 -0
  88. data/test/encryptors_test.rb +30 -0
  89. data/test/failure_app_test.rb +123 -0
  90. data/test/integration/authenticatable_test.rb +344 -0
  91. data/test/integration/confirmable_test.rb +104 -0
  92. data/test/integration/database_authenticatable_test.rb +38 -0
  93. data/test/integration/http_authenticatable_test.rb +49 -0
  94. data/test/integration/lockable_test.rb +109 -0
  95. data/test/integration/recoverable_test.rb +141 -0
  96. data/test/integration/registerable_test.rb +153 -0
  97. data/test/integration/rememberable_test.rb +91 -0
  98. data/test/integration/timeoutable_test.rb +80 -0
  99. data/test/integration/token_authenticatable_test.rb +88 -0
  100. data/test/integration/trackable_test.rb +64 -0
  101. data/test/mailers/confirmation_instructions_test.rb +80 -0
  102. data/test/mailers/reset_password_instructions_test.rb +68 -0
  103. data/test/mailers/unlock_instructions_test.rb +62 -0
  104. data/test/mapping_test.rb +85 -0
  105. data/test/models/confirmable_test.rb +221 -0
  106. data/test/models/database_authenticatable_test.rb +148 -0
  107. data/test/models/lockable_test.rb +188 -0
  108. data/test/models/recoverable_test.rb +138 -0
  109. data/test/models/rememberable_test.rb +176 -0
  110. data/test/models/timeoutable_test.rb +28 -0
  111. data/test/models/token_authenticatable_test.rb +37 -0
  112. data/test/models/trackable_test.rb +5 -0
  113. data/test/models/validatable_test.rb +99 -0
  114. data/test/models_test.rb +77 -0
  115. data/test/orm/active_record.rb +9 -0
  116. data/test/orm/mongoid.rb +10 -0
  117. data/test/rails_app/app/active_record/admin.rb +3 -0
  118. data/test/rails_app/app/active_record/shim.rb +2 -0
  119. data/test/rails_app/app/active_record/user.rb +7 -0
  120. data/test/rails_app/app/controllers/admins_controller.rb +6 -0
  121. data/test/rails_app/app/controllers/application_controller.rb +9 -0
  122. data/test/rails_app/app/controllers/home_controller.rb +7 -0
  123. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
  124. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
  125. data/test/rails_app/app/controllers/sessions_controller.rb +6 -0
  126. data/test/rails_app/app/controllers/users_controller.rb +18 -0
  127. data/test/rails_app/app/helpers/application_helper.rb +3 -0
  128. data/test/rails_app/app/mongoid/admin.rb +6 -0
  129. data/test/rails_app/app/mongoid/shim.rb +16 -0
  130. data/test/rails_app/app/mongoid/user.rb +10 -0
  131. data/test/rails_app/config/application.rb +35 -0
  132. data/test/rails_app/config/boot.rb +13 -0
  133. data/test/rails_app/config/environment.rb +5 -0
  134. data/test/rails_app/config/environments/development.rb +19 -0
  135. data/test/rails_app/config/environments/production.rb +33 -0
  136. data/test/rails_app/config/environments/test.rb +33 -0
  137. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  138. data/test/rails_app/config/initializers/devise.rb +136 -0
  139. data/test/rails_app/config/initializers/inflections.rb +2 -0
  140. data/test/rails_app/config/initializers/secret_token.rb +2 -0
  141. data/test/rails_app/config/routes.rb +47 -0
  142. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +27 -0
  143. data/test/rails_app/db/schema.rb +86 -0
  144. data/test/routes_test.rb +146 -0
  145. data/test/support/assertions.rb +24 -0
  146. data/test/support/helpers.rb +54 -0
  147. data/test/support/integration.rb +88 -0
  148. data/test/support/test_silencer.rb +5 -0
  149. data/test/support/webrat/integrations/rails.rb +32 -0
  150. data/test/test_helper.rb +21 -0
  151. data/test/test_helpers_test.rb +72 -0
  152. metadata +230 -0
@@ -0,0 +1,55 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'rake'
4
+ require 'rake/testtask'
5
+ require 'rake/rdoctask'
6
+ require File.join(File.dirname(__FILE__), 'lib', 'devise', 'version')
7
+
8
+ desc 'Default: run tests for all ORMs.'
9
+ task :default => :pre_commit
10
+
11
+ desc 'Run Devise tests for all ORMs.'
12
+ task :pre_commit do
13
+ Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
14
+ orm = File.basename(file).split(".").first
15
+ system "rake test DEVISE_ORM=#{orm}"
16
+ end
17
+ end
18
+
19
+ desc 'Run Devise unit tests.'
20
+ Rake::TestTask.new(:test) do |t|
21
+ t.libs << 'lib'
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = true
25
+ end
26
+
27
+ desc 'Generate documentation for Devise.'
28
+ Rake::RDocTask.new(:rdoc) do |rdoc|
29
+ rdoc.rdoc_dir = 'rdoc'
30
+ rdoc.title = 'Devise'
31
+ rdoc.options << '--line-numbers' << '--inline-source'
32
+ rdoc.rdoc_files.include('README.rdoc')
33
+ rdoc.rdoc_files.include('lib/**/*.rb')
34
+ end
35
+
36
+ begin
37
+ require 'jeweler'
38
+ Jeweler::Tasks.new do |s|
39
+ s.name = "devise"
40
+ s.version = Devise::VERSION.dup
41
+ s.summary = "Flexible authentication solution for Rails with Warden"
42
+ s.email = "contact@plataformatec.com.br"
43
+ s.homepage = "http://github.com/plataformatec/devise"
44
+ s.description = "Flexible authentication solution for Rails with Warden"
45
+ s.authors = ['José Valim', 'Carlos Antônio']
46
+ s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
47
+ s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)
48
+ s.add_dependency("warden", "~> 0.10.7")
49
+ #s.add_dependency("bcrypt-ruby", "~> 2.1.2")
50
+ end
51
+
52
+ Jeweler::GemcutterTasks.new
53
+ rescue LoadError
54
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
55
+ end
data/TODO ADDED
@@ -0,0 +1,3 @@
1
+ * Move integration tests to Capybara
2
+ * Better ORM integration
3
+ * Extract activatable models tests from confirmable
@@ -0,0 +1,33 @@
1
+ class Devise::ConfirmationsController < ApplicationController
2
+ include Devise::Controllers::InternalHelpers
3
+
4
+ # GET /resource/confirmation/new
5
+ def new
6
+ build_resource
7
+ render_with_scope :new
8
+ end
9
+
10
+ # POST /resource/confirmation
11
+ def create
12
+ self.resource = resource_class.send_confirmation_instructions(params[resource_name])
13
+
14
+ if resource.errors.empty?
15
+ set_flash_message :notice, :send_instructions
16
+ redirect_to new_session_path(resource_name)
17
+ else
18
+ render_with_scope :new
19
+ end
20
+ end
21
+
22
+ # GET /resource/confirmation?confirmation_token=abcdef
23
+ def show
24
+ self.resource = resource_class.confirm_by_token(params[:confirmation_token])
25
+
26
+ if resource.errors.empty?
27
+ set_flash_message :notice, :confirmed
28
+ sign_in_and_redirect(resource_name, resource)
29
+ else
30
+ render_with_scope :new
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,41 @@
1
+ class Devise::PasswordsController < ApplicationController
2
+ prepend_before_filter :require_no_authentication
3
+ include Devise::Controllers::InternalHelpers
4
+
5
+ # GET /resource/password/new
6
+ def new
7
+ build_resource
8
+ render_with_scope :new
9
+ end
10
+
11
+ # POST /resource/password
12
+ def create
13
+ self.resource = resource_class.send_reset_password_instructions(params[resource_name])
14
+
15
+ if resource.errors.empty?
16
+ set_flash_message :notice, :send_instructions
17
+ redirect_to new_session_path(resource_name)
18
+ else
19
+ render_with_scope :new
20
+ end
21
+ end
22
+
23
+ # GET /resource/password/edit?reset_password_token=abcdef
24
+ def edit
25
+ self.resource = resource_class.new
26
+ resource.reset_password_token = params[:reset_password_token]
27
+ render_with_scope :edit
28
+ end
29
+
30
+ # PUT /resource/password
31
+ def update
32
+ self.resource = resource_class.reset_password_by_token(params[resource_name])
33
+
34
+ if resource.errors.empty?
35
+ set_flash_message :notice, :updated
36
+ sign_in_and_redirect(resource_name, resource)
37
+ else
38
+ render_with_scope :edit
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,57 @@
1
+ class Devise::RegistrationsController < ApplicationController
2
+ prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
3
+ prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
4
+ include Devise::Controllers::InternalHelpers
5
+
6
+ # GET /resource/sign_up
7
+ def new
8
+ build_resource({})
9
+ render_with_scope :new
10
+ end
11
+
12
+ # POST /resource/sign_up
13
+ def create
14
+ build_resource
15
+
16
+ if resource.save
17
+ set_flash_message :notice, :signed_up
18
+ sign_in_and_redirect(resource_name, resource)
19
+ else
20
+ clean_up_passwords(resource)
21
+ render_with_scope :new
22
+ end
23
+ end
24
+
25
+ # GET /resource/edit
26
+ def edit
27
+ render_with_scope :edit
28
+ end
29
+
30
+ # PUT /resource
31
+ def update
32
+ if resource.update_with_password(params[resource_name])
33
+ set_flash_message :notice, :updated
34
+ redirect_to after_update_path_for(resource)
35
+ else
36
+ clean_up_passwords(resource)
37
+ render_with_scope :edit
38
+ end
39
+ end
40
+
41
+ # DELETE /resource
42
+ def destroy
43
+ resource.destroy
44
+ set_flash_message :notice, :destroyed
45
+ sign_out_and_redirect(self.resource)
46
+ end
47
+
48
+ protected
49
+
50
+ # Authenticates the current scope and gets a copy of the current resource.
51
+ # We need to use a copy because we don't want actions like update changing
52
+ # the current user in place.
53
+ def authenticate_scope!
54
+ send(:"authenticate_#{resource_name}!")
55
+ self.resource = resource_class.find(send(:"current_#{resource_name}").id)
56
+ end
57
+ end
@@ -0,0 +1,23 @@
1
+ class Devise::SessionsController < ApplicationController
2
+ prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
3
+ include Devise::Controllers::InternalHelpers
4
+
5
+ # GET /resource/sign_in
6
+ def new
7
+ clean_up_passwords(build_resource)
8
+ render_with_scope :new
9
+ end
10
+
11
+ # POST /resource/sign_in
12
+ def create
13
+ resource = warden.authenticate!(:scope => resource_name, :recall => "new")
14
+ set_flash_message :notice, :signed_in
15
+ sign_in_and_redirect(resource_name, resource)
16
+ end
17
+
18
+ # GET /resource/sign_out
19
+ def destroy
20
+ set_flash_message :notice, :signed_out if signed_in?(resource_name)
21
+ sign_out_and_redirect(resource_name)
22
+ end
23
+ end
@@ -0,0 +1,34 @@
1
+ class Devise::UnlocksController < ApplicationController
2
+ prepend_before_filter :require_no_authentication
3
+ include Devise::Controllers::InternalHelpers
4
+
5
+ # GET /resource/unlock/new
6
+ def new
7
+ build_resource
8
+ render_with_scope :new
9
+ end
10
+
11
+ # POST /resource/unlock
12
+ def create
13
+ self.resource = resource_class.send_unlock_instructions(params[resource_name])
14
+
15
+ if resource.errors.empty?
16
+ set_flash_message :notice, :send_instructions
17
+ redirect_to new_session_path(resource_name)
18
+ else
19
+ render_with_scope :new
20
+ end
21
+ end
22
+
23
+ # GET /resource/unlock?unlock_token=abcdef
24
+ def show
25
+ self.resource = resource_class.unlock_access_by_token(params[:unlock_token])
26
+
27
+ if resource.errors.empty?
28
+ set_flash_message :notice, :unlocked
29
+ sign_in_and_redirect(resource_name, resource)
30
+ else
31
+ render_with_scope :new
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,17 @@
1
+ module DeviseHelper
2
+ def devise_error_messages!
3
+ return "" if resource.errors.empty?
4
+
5
+ messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
6
+ sentence = "#{pluralize(resource.errors.count, "error")} prohibited this #{resource_name} from being saved:"
7
+
8
+ html = <<-HTML
9
+ <div id="error_explanation">
10
+ <h2>#{sentence}</h2>
11
+ <ul>#{messages}</ul>
12
+ </div>
13
+ HTML
14
+
15
+ html.html_safe
16
+ end
17
+ end
@@ -0,0 +1,71 @@
1
+ class Devise::Mailer < ::ActionMailer::Base
2
+ include Devise::Controllers::ScopedViews
3
+ attr_reader :devise_mapping, :resource
4
+
5
+ def confirmation_instructions(record)
6
+ setup_mail(record, :confirmation_instructions)
7
+ end
8
+
9
+ def reset_password_instructions(record)
10
+ setup_mail(record, :reset_password_instructions)
11
+ end
12
+
13
+ def unlock_instructions(record)
14
+ setup_mail(record, :unlock_instructions)
15
+ end
16
+
17
+ private
18
+
19
+ # Configure default email options
20
+ def setup_mail(record, action)
21
+ @scope_name = Devise::Mapping.find_scope!(record)
22
+ @devise_mapping = Devise.mappings[@scope_name]
23
+ @resource = instance_variable_set("@#{@devise_mapping.name}", record)
24
+
25
+ headers = {
26
+ :subject => translate(@devise_mapping, action),
27
+ :from => mailer_sender(@devise_mapping),
28
+ :to => record.email,
29
+ :template_path => template_paths
30
+ }
31
+
32
+ headers.merge!(record.headers_for(action)) if record.respond_to?(:headers_for)
33
+ mail(headers)
34
+ end
35
+
36
+ def mailer_sender(mapping)
37
+ if Devise.mailer_sender.is_a?(Proc)
38
+ Devise.mailer_sender.call(mapping.name)
39
+ else
40
+ Devise.mailer_sender
41
+ end
42
+ end
43
+
44
+ def template_paths
45
+ template_path = [self.class.mailer_name]
46
+ template_path.unshift "#{@devise_mapping.plural}/mailer" if self.class.scoped_views?
47
+ template_path
48
+ end
49
+
50
+ # Setup a subject doing an I18n lookup. At first, it attemps to set a subject
51
+ # based on the current mapping:
52
+ #
53
+ # en:
54
+ # devise:
55
+ # mailer:
56
+ # confirmation_instructions:
57
+ # user_subject: '...'
58
+ #
59
+ # If one does not exist, it fallbacks to ActionMailer default:
60
+ #
61
+ # en:
62
+ # devise:
63
+ # mailer:
64
+ # confirmation_instructions:
65
+ # subject: '...'
66
+ #
67
+ def translate(mapping, key)
68
+ I18n.t(:"#{mapping.name}_subject", :scope => [:devise, :mailer, key],
69
+ :default => [:subject, key.to_s.humanize])
70
+ end
71
+ end
@@ -0,0 +1,12 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Resend confirmation instructions" %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,5 @@
1
+ <p>Welcome <%= @resource.email %>!</p>
2
+
3
+ <p>You can confirm your account through the link below:</p>
4
+
5
+ <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
@@ -0,0 +1,8 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
4
+
5
+ <p>Click the link below to unlock your account:</p>
6
+
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
@@ -0,0 +1,16 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <p><%= f.label :password %><br />
8
+ <%= f.password_field :password %></p>
9
+
10
+ <p><%= f.label :password_confirmation %><br />
11
+ <%= f.password_field :password_confirmation %></p>
12
+
13
+ <p><%= f.submit "Change my password" %></p>
14
+ <% end %>
15
+
16
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,12 @@
1
+ <h2>Forgot your password?</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Send me reset password instructions" %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,25 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
10
+ <%= f.password_field :password %></p>
11
+
12
+ <p><%= f.label :password_confirmation %><br />
13
+ <%= f.password_field :password_confirmation %></p>
14
+
15
+ <p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
16
+ <%= f.password_field :current_password %></p>
17
+
18
+ <p><%= f.submit "Update" %></p>
19
+ <% end %>
20
+
21
+ <h3>Cancel my account</h3>
22
+
23
+ <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
24
+
25
+ <%= link_to "Back", :back %>
@@ -0,0 +1,18 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.label :password %><br />
10
+ <%= f.password_field :password %></p>
11
+
12
+ <p><%= f.label :password_confirmation %><br />
13
+ <%= f.password_field :password_confirmation %></p>
14
+
15
+ <p><%= f.submit "Sign up" %></p>
16
+ <% end %>
17
+
18
+ <%= render :partial => "devise/shared/links" %>