mongoid-devise 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +333 -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 +42 -0
- data/app/controllers/registrations_controller.rb +55 -0
- data/app/controllers/sessions_controller.rb +45 -0
- data/app/controllers/unlocks_controller.rb +33 -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 +18 -0
- data/generators/devise_install/templates/devise.rb +102 -0
- data/generators/devise_views/USAGE +3 -0
- data/generators/devise_views/devise_views_generator.rb +21 -0
- data/init.rb +2 -0
- data/lib/devise.rb +253 -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 +30 -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 +131 -0
- data/lib/devise/models.rb +112 -0
- data/lib/devise/models/activatable.rb +16 -0
- data/lib/devise/models/authenticatable.rb +146 -0
- data/lib/devise/models/confirmable.rb +172 -0
- data/lib/devise/models/http_authenticatable.rb +21 -0
- data/lib/devise/models/lockable.rb +160 -0
- data/lib/devise/models/recoverable.rb +80 -0
- data/lib/devise/models/registerable.rb +8 -0
- data/lib/devise/models/rememberable.rb +94 -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 +48 -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 +51 -0
- data/lib/devise/orm/mongoid.rb +60 -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 +65 -0
- data/lib/devise/strategies/authenticatable.rb +36 -0
- data/lib/devise/strategies/base.rb +16 -0
- data/lib/devise/strategies/http_authenticatable.rb +49 -0
- data/lib/devise/strategies/rememberable.rb +37 -0
- data/lib/devise/strategies/token_authenticatable.rb +37 -0
- data/lib/devise/test_helpers.rb +86 -0
- data/lib/devise/version.rb +3 -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 +69 -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 +44 -0
- data/test/integration/lockable_test.rb +83 -0
- data/test/integration/recoverable_test.rb +141 -0
- data/test/integration/registerable_test.rb +130 -0
- data/test/integration/rememberable_test.rb +63 -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 +80 -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 +153 -0
- data/test/models/authenticatable_test.rb +180 -0
- data/test/models/confirmable_test.rb +228 -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 +56 -0
- data/test/orm/active_record.rb +31 -0
- data/test/orm/mongo_mapper.rb +20 -0
- data/test/orm/mongoid.rb +22 -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 +10 -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 +9 -0
- data/test/rails_app/app/mongo_mapper/user.rb +8 -0
- data/test/rails_app/app/mongoid/admin.rb +9 -0
- data/test/rails_app/app/mongoid/user.rb +8 -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 +79 -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 +216 -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 = "mongoid-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}/**/*", "init.rb"]
|
47
|
+
s.add_dependency("warden", "~> 0.9.0")
|
48
|
+
end
|
49
|
+
|
50
|
+
Jeweler::GemcutterTasks.new
|
51
|
+
rescue LoadError
|
52
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
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!(:confirmation_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,42 @@
|
|
1
|
+
class PasswordsController < ApplicationController
|
2
|
+
include Devise::Controllers::InternalHelpers
|
3
|
+
|
4
|
+
before_filter :require_no_authentication
|
5
|
+
|
6
|
+
# GET /resource/password/new
|
7
|
+
def new
|
8
|
+
build_resource
|
9
|
+
render_with_scope :new
|
10
|
+
end
|
11
|
+
|
12
|
+
# POST /resource/password
|
13
|
+
def create
|
14
|
+
self.resource = resource_class.send_reset_password_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/password/edit?reset_password_token=abcdef
|
25
|
+
def edit
|
26
|
+
self.resource = resource_class.new
|
27
|
+
resource.reset_password_token = params[:reset_password_token]
|
28
|
+
render_with_scope :edit
|
29
|
+
end
|
30
|
+
|
31
|
+
# PUT /resource/password
|
32
|
+
def update
|
33
|
+
self.resource = resource_class.reset_password!(params[resource_name])
|
34
|
+
|
35
|
+
if resource.errors.empty?
|
36
|
+
set_flash_message :notice, :updated
|
37
|
+
sign_in_and_redirect(resource_name, resource)
|
38
|
+
else
|
39
|
+
render_with_scope :edit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class RegistrationsController < ApplicationController
|
2
|
+
include Devise::Controllers::InternalHelpers
|
3
|
+
|
4
|
+
before_filter :require_no_authentication, :only => [ :new, :create ]
|
5
|
+
before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
|
6
|
+
|
7
|
+
# GET /resource/sign_in
|
8
|
+
def new
|
9
|
+
build_resource
|
10
|
+
render_with_scope :new
|
11
|
+
end
|
12
|
+
|
13
|
+
# POST /resource/sign_up
|
14
|
+
def create
|
15
|
+
build_resource
|
16
|
+
|
17
|
+
if resource.save
|
18
|
+
flash[:"#{resource_name}_signed_up"] = true
|
19
|
+
set_flash_message :notice, :signed_up
|
20
|
+
sign_in_and_redirect(resource_name, resource)
|
21
|
+
else
|
22
|
+
render_with_scope :new
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# GET /resource/edit
|
27
|
+
def edit
|
28
|
+
render_with_scope :edit
|
29
|
+
end
|
30
|
+
|
31
|
+
# PUT /resource
|
32
|
+
def update
|
33
|
+
if self.resource.update_with_password(params[resource_name])
|
34
|
+
set_flash_message :notice, :updated
|
35
|
+
redirect_to after_sign_in_path_for(self.resource)
|
36
|
+
else
|
37
|
+
render_with_scope :edit
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# DELETE /resource
|
42
|
+
def destroy
|
43
|
+
self.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 dup the resource
|
51
|
+
def authenticate_scope!
|
52
|
+
send(:"authenticate_#{resource_name}!")
|
53
|
+
self.resource = send(:"current_#{resource_name}").dup
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class SessionsController < ApplicationController
|
2
|
+
include Devise::Controllers::InternalHelpers
|
3
|
+
|
4
|
+
before_filter :require_no_authentication, :only => [ :new, :create ]
|
5
|
+
|
6
|
+
# GET /resource/sign_in
|
7
|
+
def new
|
8
|
+
unless resource_just_signed_up?
|
9
|
+
Devise::FLASH_MESSAGES.each do |message|
|
10
|
+
set_now_flash_message :alert, message if params.try(:[], message) == "true"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
build_resource
|
15
|
+
render_with_scope :new
|
16
|
+
end
|
17
|
+
|
18
|
+
# POST /resource/sign_in
|
19
|
+
def create
|
20
|
+
if resource = authenticate(resource_name)
|
21
|
+
set_flash_message :notice, :signed_in
|
22
|
+
sign_in_and_redirect(resource_name, resource, true)
|
23
|
+
else
|
24
|
+
set_now_flash_message :alert, (warden.message || :invalid)
|
25
|
+
clean_up_passwords(build_resource)
|
26
|
+
render_with_scope :new
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# GET /resource/sign_out
|
31
|
+
def destroy
|
32
|
+
set_flash_message :notice, :signed_out if signed_in?(resource_name)
|
33
|
+
sign_out_and_redirect(resource_name)
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
def resource_just_signed_up?
|
39
|
+
flash[:"#{resource_name}_signed_up"]
|
40
|
+
end
|
41
|
+
|
42
|
+
def clean_up_passwords(object)
|
43
|
+
object.clean_up_passwords if object.respond_to?(:clean_up_passwords)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class UnlocksController < ApplicationController
|
2
|
+
include Devise::Controllers::InternalHelpers
|
3
|
+
|
4
|
+
# GET /resource/unlock/new
|
5
|
+
def new
|
6
|
+
build_resource
|
7
|
+
render_with_scope :new
|
8
|
+
end
|
9
|
+
|
10
|
+
# POST /resource/unlock
|
11
|
+
def create
|
12
|
+
self.resource = resource_class.send_unlock_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/unlock?unlock_token=abcdef
|
23
|
+
def show
|
24
|
+
self.resource = resource_class.unlock!(:unlock_token => params[:unlock_token])
|
25
|
+
|
26
|
+
if resource.errors.empty?
|
27
|
+
set_flash_message :notice, :unlocked
|
28
|
+
sign_in_and_redirect(resource_name, resource)
|
29
|
+
else
|
30
|
+
render_with_scope :new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
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
|
+
mapping = Devise::Mapping.find_by_class(record.class)
|
24
|
+
raise "Invalid devise resource #{record}" unless mapping
|
25
|
+
|
26
|
+
subject translate(mapping, key)
|
27
|
+
from mailer_sender(mapping)
|
28
|
+
recipients record.email
|
29
|
+
sent_on Time.now
|
30
|
+
content_type 'text/html'
|
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
|
+
Hello <%= @resource.email %>!
|
2
|
+
|
3
|
+
Someone has requested a link to change your password, and you can do this through the link below.
|
4
|
+
|
5
|
+
<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
|
6
|
+
|
7
|
+
If you didn't request this, please ignore this email.
|
8
|
+
Your password won't change until you access the link above and create a new one.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Hello <%= @resource.email %>!
|
2
|
+
|
3
|
+
Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
|
4
|
+
|
5
|
+
Click the link below to unlock your account:
|
6
|
+
|
7
|
+
<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>
|
@@ -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" %>
|