dcu-devise 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +378 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +260 -0
- data/Rakefile +53 -0
- data/TODO +2 -0
- data/app/controllers/confirmations_controller.rb +33 -0
- data/app/controllers/passwords_controller.rb +41 -0
- data/app/controllers/registrations_controller.rb +53 -0
- data/app/controllers/sessions_controller.rb +44 -0
- data/app/controllers/unlocks_controller.rb +41 -0
- data/app/models/devise_mailer.rb +68 -0
- data/app/views/confirmations/new.html.erb +12 -0
- data/app/views/devise_mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise_mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise_mailer/unlock_instructions.html.erb +7 -0
- data/app/views/passwords/edit.html.erb +16 -0
- data/app/views/passwords/new.html.erb +12 -0
- data/app/views/registrations/edit.html.erb +25 -0
- data/app/views/registrations/new.html.erb +17 -0
- data/app/views/sessions/new.html.erb +17 -0
- data/app/views/shared/_devise_links.erb +19 -0
- data/app/views/unlocks/new.html.erb +12 -0
- data/generators/devise/USAGE +5 -0
- data/generators/devise/devise_generator.rb +15 -0
- data/generators/devise/lib/route_devise.rb +32 -0
- data/generators/devise/templates/migration.rb +23 -0
- data/generators/devise/templates/model.rb +9 -0
- data/generators/devise_install/USAGE +3 -0
- data/generators/devise_install/devise_install_generator.rb +15 -0
- data/generators/devise_install/templates/README +23 -0
- data/generators/devise_install/templates/devise.rb +105 -0
- data/generators/devise_views/USAGE +3 -0
- data/generators/devise_views/devise_views_generator.rb +21 -0
- data/lib/devise.rb +264 -0
- data/lib/devise/controllers/helpers.rb +200 -0
- data/lib/devise/controllers/internal_helpers.rb +129 -0
- data/lib/devise/controllers/url_helpers.rb +41 -0
- data/lib/devise/encryptors/authlogic_sha512.rb +21 -0
- data/lib/devise/encryptors/base.rb +20 -0
- data/lib/devise/encryptors/bcrypt.rb +21 -0
- data/lib/devise/encryptors/clearance_sha1.rb +19 -0
- data/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
- data/lib/devise/encryptors/sha1.rb +27 -0
- data/lib/devise/encryptors/sha512.rb +27 -0
- data/lib/devise/failure_app.rb +65 -0
- data/lib/devise/hooks/activatable.rb +15 -0
- data/lib/devise/hooks/rememberable.rb +32 -0
- data/lib/devise/hooks/timeoutable.rb +18 -0
- data/lib/devise/hooks/trackable.rb +18 -0
- data/lib/devise/locales/en.yml +35 -0
- data/lib/devise/mapping.rb +128 -0
- data/lib/devise/models.rb +117 -0
- data/lib/devise/models/activatable.rb +16 -0
- data/lib/devise/models/confirmable.rb +162 -0
- data/lib/devise/models/database_authenticatable.rb +144 -0
- data/lib/devise/models/http_authenticatable.rb +21 -0
- data/lib/devise/models/lockable.rb +150 -0
- data/lib/devise/models/recoverable.rb +80 -0
- data/lib/devise/models/registerable.rb +8 -0
- data/lib/devise/models/rememberable.rb +92 -0
- data/lib/devise/models/timeoutable.rb +28 -0
- data/lib/devise/models/token_authenticatable.rb +89 -0
- data/lib/devise/models/trackable.rb +16 -0
- data/lib/devise/models/validatable.rb +39 -0
- data/lib/devise/orm/active_record.rb +41 -0
- data/lib/devise/orm/data_mapper.rb +83 -0
- data/lib/devise/orm/mongo_mapper.rb +47 -0
- data/lib/devise/rails.rb +14 -0
- data/lib/devise/rails/routes.rb +125 -0
- data/lib/devise/rails/warden_compat.rb +25 -0
- data/lib/devise/schema.rb +73 -0
- data/lib/devise/strategies/base.rb +16 -0
- data/lib/devise/strategies/database_authenticatable.rb +36 -0
- data/lib/devise/strategies/http_authenticatable.rb +59 -0
- data/lib/devise/strategies/rememberable.rb +37 -0
- data/lib/devise/strategies/token_authenticatable.rb +37 -0
- data/lib/devise/test_helpers.rb +90 -0
- data/lib/devise/version.rb +3 -0
- data/rails/init.rb +2 -0
- data/test/controllers/helpers_test.rb +177 -0
- data/test/controllers/internal_helpers_test.rb +55 -0
- data/test/controllers/url_helpers_test.rb +47 -0
- data/test/devise_test.rb +74 -0
- data/test/encryptors_test.rb +31 -0
- data/test/failure_app_test.rb +44 -0
- data/test/integration/authenticatable_test.rb +271 -0
- data/test/integration/confirmable_test.rb +97 -0
- data/test/integration/http_authenticatable_test.rb +52 -0
- data/test/integration/lockable_test.rb +102 -0
- data/test/integration/rack_middleware_test.rb +47 -0
- data/test/integration/recoverable_test.rb +141 -0
- data/test/integration/registerable_test.rb +144 -0
- data/test/integration/rememberable_test.rb +71 -0
- data/test/integration/timeoutable_test.rb +68 -0
- data/test/integration/token_authenticatable_test.rb +55 -0
- data/test/integration/trackable_test.rb +64 -0
- data/test/mailers/confirmation_instructions_test.rb +86 -0
- data/test/mailers/reset_password_instructions_test.rb +68 -0
- data/test/mailers/unlock_instructions_test.rb +62 -0
- data/test/mapping_test.rb +148 -0
- data/test/models/authenticatable_test.rb +180 -0
- data/test/models/confirmable_test.rb +212 -0
- data/test/models/lockable_test.rb +202 -0
- data/test/models/recoverable_test.rb +138 -0
- data/test/models/rememberable_test.rb +135 -0
- data/test/models/timeoutable_test.rb +28 -0
- data/test/models/token_authenticatable_test.rb +51 -0
- data/test/models/trackable_test.rb +5 -0
- data/test/models/validatable_test.rb +106 -0
- data/test/models_test.rb +70 -0
- data/test/orm/active_record.rb +31 -0
- data/test/orm/mongo_mapper.rb +20 -0
- data/test/rails_app/app/active_record/admin.rb +7 -0
- data/test/rails_app/app/active_record/user.rb +7 -0
- data/test/rails_app/app/controllers/admins_controller.rb +6 -0
- data/test/rails_app/app/controllers/application_controller.rb +12 -0
- data/test/rails_app/app/controllers/home_controller.rb +4 -0
- data/test/rails_app/app/controllers/users_controller.rb +16 -0
- data/test/rails_app/app/helpers/application_helper.rb +3 -0
- data/test/rails_app/app/mongo_mapper/admin.rb +13 -0
- data/test/rails_app/app/mongo_mapper/user.rb +14 -0
- data/test/rails_app/config/boot.rb +110 -0
- data/test/rails_app/config/environment.rb +42 -0
- data/test/rails_app/config/environments/development.rb +17 -0
- data/test/rails_app/config/environments/production.rb +28 -0
- data/test/rails_app/config/environments/test.rb +28 -0
- data/test/rails_app/config/initializers/devise.rb +82 -0
- data/test/rails_app/config/initializers/inflections.rb +2 -0
- data/test/rails_app/config/initializers/new_rails_defaults.rb +24 -0
- data/test/rails_app/config/initializers/session_store.rb +15 -0
- data/test/rails_app/config/routes.rb +21 -0
- data/test/routes_test.rb +110 -0
- data/test/support/assertions_helper.rb +37 -0
- data/test/support/integration_tests_helper.rb +71 -0
- data/test/support/test_silencer.rb +5 -0
- data/test/support/tests_helper.rb +39 -0
- data/test/test_helper.rb +21 -0
- data/test/test_helpers_test.rb +57 -0
- metadata +213 -0
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
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
|
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,generators,lib}/**/*", "rails/init.rb"]
|
47
|
+
s.add_dependency("warden", "~> 0.10.3")
|
48
|
+
end
|
49
|
+
|
50
|
+
Jeweler::GemcutterTasks.new
|
51
|
+
rescue LoadError
|
52
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
|
53
|
+
end
|
data/TODO
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
class 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 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,53 @@
|
|
1
|
+
class 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_in
|
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
|
+
render_with_scope :new
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /resource/edit
|
25
|
+
def edit
|
26
|
+
render_with_scope :edit
|
27
|
+
end
|
28
|
+
|
29
|
+
# PUT /resource
|
30
|
+
def update
|
31
|
+
if self.resource.update_with_password(params[resource_name])
|
32
|
+
set_flash_message :notice, :updated
|
33
|
+
redirect_to after_sign_in_path_for(self.resource)
|
34
|
+
else
|
35
|
+
render_with_scope :edit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# DELETE /resource
|
40
|
+
def destroy
|
41
|
+
self.resource.destroy
|
42
|
+
set_flash_message :notice, :destroyed
|
43
|
+
sign_out_and_redirect(self.resource)
|
44
|
+
end
|
45
|
+
|
46
|
+
protected
|
47
|
+
|
48
|
+
# Authenticates the current scope and dup the resource
|
49
|
+
def authenticate_scope!
|
50
|
+
send(:"authenticate_#{resource_name}!")
|
51
|
+
self.resource = send(:"current_#{resource_name}").dup
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class 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
|
+
unless flash[:notice].present?
|
8
|
+
Devise::FLASH_MESSAGES.each do |message|
|
9
|
+
set_now_flash_message :alert, message if params.try(:[], message) == "true"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
build_resource
|
14
|
+
render_with_scope :new
|
15
|
+
end
|
16
|
+
|
17
|
+
# POST /resource/sign_in
|
18
|
+
def create
|
19
|
+
if resource = authenticate(resource_name)
|
20
|
+
if !performed?
|
21
|
+
set_flash_message :notice, :signed_in
|
22
|
+
sign_in_and_redirect(resource_name, resource, true)
|
23
|
+
end
|
24
|
+
elsif [:custom, :redirect].include?(warden.result)
|
25
|
+
throw :warden, :scope => resource_name
|
26
|
+
elsif !performed?
|
27
|
+
set_now_flash_message :alert, (warden.message || :invalid)
|
28
|
+
clean_up_passwords(build_resource)
|
29
|
+
render_with_scope :new unless performed?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# GET /resource/sign_out
|
34
|
+
def destroy
|
35
|
+
set_flash_message :notice, :signed_out if signed_in?(resource_name)
|
36
|
+
sign_out_and_redirect(resource_name)
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
def clean_up_passwords(object)
|
42
|
+
object.clean_up_passwords if object.respond_to?(:clean_up_passwords)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class UnlocksController < ApplicationController
|
2
|
+
prepend_before_filter :ensure_email_as_unlock_strategy
|
3
|
+
prepend_before_filter :require_no_authentication
|
4
|
+
include Devise::Controllers::InternalHelpers
|
5
|
+
|
6
|
+
# GET /resource/unlock/new
|
7
|
+
def new
|
8
|
+
build_resource
|
9
|
+
render_with_scope :new
|
10
|
+
end
|
11
|
+
|
12
|
+
# POST /resource/unlock
|
13
|
+
def create
|
14
|
+
self.resource = resource_class.send_unlock_instructions(params[resource_name])
|
15
|
+
|
16
|
+
if resource.errors.empty?
|
17
|
+
set_flash_message :notice, :send_instructions
|
18
|
+
redirect_to new_session_path(resource_name)
|
19
|
+
else
|
20
|
+
render_with_scope :new
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /resource/unlock?unlock_token=abcdef
|
25
|
+
def show
|
26
|
+
self.resource = resource_class.unlock_access_by_token(params[:unlock_token])
|
27
|
+
|
28
|
+
if resource.errors.empty?
|
29
|
+
set_flash_message :notice, :unlocked
|
30
|
+
sign_in_and_redirect(resource_name, resource)
|
31
|
+
else
|
32
|
+
render_with_scope :new
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
def ensure_email_as_unlock_strategy
|
39
|
+
raise ActionController::UnknownAction unless resource_class.unlock_strategy_enabled?(:email)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
class DeviseMailer < ::ActionMailer::Base
|
2
|
+
extend Devise::Controllers::InternalHelpers::ScopedViews
|
3
|
+
|
4
|
+
# Deliver confirmation instructions when the user is created or its email is
|
5
|
+
# updated, and also when confirmation is manually requested
|
6
|
+
def confirmation_instructions(record)
|
7
|
+
setup_mail(record, :confirmation_instructions)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Deliver reset password instructions when manually requested
|
11
|
+
def reset_password_instructions(record)
|
12
|
+
setup_mail(record, :reset_password_instructions)
|
13
|
+
end
|
14
|
+
|
15
|
+
def unlock_instructions(record)
|
16
|
+
setup_mail(record, :unlock_instructions)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# Configure default email options
|
22
|
+
def setup_mail(record, key)
|
23
|
+
scope_name = Devise::Mapping.find_scope!(record)
|
24
|
+
mapping = Devise.mappings[scope_name]
|
25
|
+
|
26
|
+
subject translate(mapping, key)
|
27
|
+
from mailer_sender(mapping)
|
28
|
+
recipients record.email
|
29
|
+
sent_on Time.now
|
30
|
+
content_type Devise.mailer_content_type
|
31
|
+
body render_with_scope(key, mapping, mapping.name => record, :resource => record)
|
32
|
+
end
|
33
|
+
|
34
|
+
def render_with_scope(key, mapping, assigns)
|
35
|
+
if self.class.scoped_views
|
36
|
+
begin
|
37
|
+
render :file => "devise_mailer/#{mapping.as}/#{key}", :body => assigns
|
38
|
+
rescue ActionView::MissingTemplate
|
39
|
+
render :file => "devise_mailer/#{key}", :body => assigns
|
40
|
+
end
|
41
|
+
else
|
42
|
+
render :file => "devise_mailer/#{key}", :body => assigns
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def mailer_sender(mapping)
|
47
|
+
if Devise.mailer_sender.is_a?(Proc)
|
48
|
+
block_args = mapping.name if Devise.mailer_sender.arity > 0
|
49
|
+
Devise.mailer_sender.call(block_args)
|
50
|
+
else
|
51
|
+
Devise.mailer_sender
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Setup subject namespaced by model. It means you're able to setup your
|
56
|
+
# messages using specific resource scope, or provide a default one.
|
57
|
+
# Example (i18n locale file):
|
58
|
+
#
|
59
|
+
# en:
|
60
|
+
# devise:
|
61
|
+
# mailer:
|
62
|
+
# confirmation_instructions: '...'
|
63
|
+
# user:
|
64
|
+
# confirmation_instructions: '...'
|
65
|
+
def translate(mapping, key)
|
66
|
+
I18n.t(:"#{mapping.name}.#{key}", :scope => [:devise, :mailer], :default => key)
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
2
|
+
|
3
|
+
<% form_for resource_name, resource, :url => confirmation_path(resource_name) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %></p>
|
7
|
+
<p><%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.submit "Resend confirmation instructions" %></p>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render :partial => "shared/devise_links" %>
|
@@ -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_name, resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
6
|
+
|
7
|
+
<p><%= f.label :password %></p>
|
8
|
+
<p><%= f.password_field :password %></p>
|
9
|
+
|
10
|
+
<p><%= f.label :password_confirmation %></p>
|
11
|
+
<p><%= f.password_field :password_confirmation %></p>
|
12
|
+
|
13
|
+
<p><%= f.submit "Change my password" %></p>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render :partial => "shared/devise_links" %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Forgot your password?</h2>
|
2
|
+
|
3
|
+
<% form_for resource_name, resource, :url => password_path(resource_name) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %></p>
|
7
|
+
<p><%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.submit "Send me reset password instructions" %></p>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render :partial => "shared/devise_links" %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
2
|
+
|
3
|
+
<% form_for resource_name, resource, :url => registration_path(resource_name), :html => { :method => :put } do |f| -%>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %></p>
|
7
|
+
<p><%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i></p>
|
10
|
+
<p><%= f.password_field :password %></p>
|
11
|
+
|
12
|
+
<p><%= f.label :password_confirmation %></p>
|
13
|
+
<p><%= f.password_field :password_confirmation %></p>
|
14
|
+
|
15
|
+
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i></p>
|
16
|
+
<p><%= 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
|
+
<%= render :partial => "shared/devise_links" %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h2>Sign up</h2>
|
2
|
+
|
3
|
+
<% form_for resource_name, resource, :url => registration_path(resource_name) do |f| -%>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
<p><%= f.label :email %></p>
|
6
|
+
<p><%= f.text_field :email %></p>
|
7
|
+
|
8
|
+
<p><%= f.label :password %></p>
|
9
|
+
<p><%= f.password_field :password %></p>
|
10
|
+
|
11
|
+
<p><%= f.label :password_confirmation %></p>
|
12
|
+
<p><%= f.password_field :password_confirmation %></p>
|
13
|
+
|
14
|
+
<p><%= f.submit "Sign up" %></p>
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
<%= render :partial => "shared/devise_links" %>
|