develon-authlogic_generator 0.5.1 → 0.5.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 (30) hide show
  1. data/generators/authlogic_generator/authlogic_generator_generator.rb +82 -0
  2. data/generators/authlogic_generator/lib/insert_routes.rb +45 -0
  3. data/generators/authlogic_generator/templates/controllers/activations_controller.rb +17 -0
  4. data/generators/authlogic_generator/templates/controllers/password_resets_controller.rb +58 -0
  5. data/generators/authlogic_generator/templates/controllers/user_sessions_controller.rb +26 -0
  6. data/generators/authlogic_generator/templates/controllers/users_controller.rb +66 -0
  7. data/generators/authlogic_generator/templates/lib/authlogic_user.rb +40 -0
  8. data/generators/authlogic_generator/templates/migrate/create_users_and_sessions.rb +39 -0
  9. data/generators/authlogic_generator/templates/models/notifier.rb +33 -0
  10. data/generators/authlogic_generator/templates/models/user.rb +29 -0
  11. data/generators/authlogic_generator/templates/models/user_session.rb +3 -0
  12. data/generators/authlogic_generator/templates/views/activations/new.html.erb +8 -0
  13. data/generators/authlogic_generator/templates/views/layouts/_usernav.html.erb +13 -0
  14. data/generators/authlogic_generator/templates/views/notifier/activation_confirmation.text.html.erb +5 -0
  15. data/generators/authlogic_generator/templates/views/notifier/activation_confirmation.text.plain.erb +5 -0
  16. data/generators/authlogic_generator/templates/views/notifier/activation_instructions.text.html.erb +5 -0
  17. data/generators/authlogic_generator/templates/views/notifier/activation_instructions.text.plain.erb +5 -0
  18. data/generators/authlogic_generator/templates/views/notifier/password_reset_instructions.text.html.erb +5 -0
  19. data/generators/authlogic_generator/templates/views/notifier/password_reset_instructions.text.plain.erb +5 -0
  20. data/generators/authlogic_generator/templates/views/password_resets/activate.html.erb +2 -0
  21. data/generators/authlogic_generator/templates/views/password_resets/index.html.erb +14 -0
  22. data/generators/authlogic_generator/templates/views/password_resets/show.html.erb +15 -0
  23. data/generators/authlogic_generator/templates/views/user_sessions/new.html.erb +19 -0
  24. data/generators/authlogic_generator/templates/views/users/_form.html.erb +12 -0
  25. data/generators/authlogic_generator/templates/views/users/edit.html.erb +9 -0
  26. data/generators/authlogic_generator/templates/views/users/new.html.erb +9 -0
  27. data/generators/authlogic_generator/templates/views/users/private.html.erb +27 -0
  28. data/generators/authlogic_generator/templates/views/users/public.html.erb +1 -0
  29. data/lib/authlogic_generator.rb +2 -0
  30. metadata +32 -5
@@ -0,0 +1,82 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/lib/insert_routes.rb")
2
+
3
+ class AuthlogicGeneratorGenerator < Rails::Generator::Base
4
+ default_options :skip_activation => false,
5
+ :skip_password_reset => false,
6
+ :skip_migration => false,
7
+ :skip_routes => false
8
+
9
+ def manifest
10
+ recorded_session = record do |m|
11
+
12
+ m.directory 'app/views/layouts'
13
+ m.directory 'app/views/notifier'
14
+ m.directory 'app/views/user_sessions'
15
+ m.directory 'app/views/users'
16
+
17
+ m.file 'controllers/user_sessions_controller.rb', 'app/controllers/user_sessions_controller.rb'
18
+ m.template 'controllers/users_controller.rb', 'app/controllers/users_controller.rb'
19
+ m.template 'models/notifier.rb', 'app/models/notifier.rb'
20
+ m.template 'models/user.rb', 'app/models/user.rb'
21
+ m.file 'models/user_session.rb', 'app/models/user_session.rb'
22
+ m.template 'views/layouts/_usernav.html.erb', 'app/views/layouts/_usernav.html.erb'
23
+ m.file 'views/notifier/activation_confirmation.text.html.erb', 'app/views/notifier/activation_confirmation.text.html.erb'
24
+ m.file 'views/notifier/activation_confirmation.text.plain.erb', 'app/views/notifier/activation_confirmation.text.plain.erb'
25
+ m.file 'views/user_sessions/new.html.erb', 'app/views/user_sessions/new.html.erb'
26
+ m.file 'views/users/_form.html.erb', 'app/views/users/_form.html.erb'
27
+ m.file 'views/users/edit.html.erb', 'app/views/users/edit.html.erb'
28
+ m.file 'views/users/new.html.erb', 'app/views/users/new.html.erb'
29
+ m.file 'views/users/private.html.erb', 'app/views/users/private.html.erb'
30
+ m.file 'views/users/public.html.erb', 'app/views/users/public.html.erb'
31
+ m.file 'lib/authlogic_user.rb', 'lib/authlogic_user.rb'
32
+
33
+ unless options[:skip_password_reset]
34
+ m.directory 'app/views/password_resets'
35
+ m.template 'controllers/password_resets_controller.rb', 'app/controllers/password_resets_controller.rb'
36
+ m.file 'views/notifier/password_reset_instructions.text.html.erb', 'app/views/notifier/password_reset_instructions.text.html.erb'
37
+ m.file 'views/notifier/password_reset_instructions.text.plain.erb', 'app/views/notifier/password_reset_instructions.text.plain.erb'
38
+ m.file 'views/password_resets/index.html.erb', 'app/views/password_resets/index.html.erb'
39
+ m.file 'views/password_resets/show.html.erb', 'app/views/password_resets/show.html.erb'
40
+ end
41
+
42
+ unless options[:skip_activation]
43
+ m.directory 'app/views/activations'
44
+ m.file 'controllers/activations_controller.rb', 'app/controllers/activations_controller.rb'
45
+ m.file 'views/activations/new.html.erb', 'app/views/activations/new.html.erb'
46
+ m.file 'views/notifier/activation_instructions.text.html.erb', 'app/views/notifier/activation_instructions.text.html.erb'
47
+ m.file 'views/notifier/activation_instructions.text.plain.erb', 'app/views/notifier/activation_instructions.text.plain.erb'
48
+ m.file 'views/password_resets/activate.html.erb', 'app/views/password_resets/activate.html.erb' unless options[:skip_password_reset]
49
+ end
50
+
51
+ unless options[:skip_routes]
52
+ m.route_resources :users
53
+ m.route_resources :password_resets unless options[:skip_password_reset]
54
+ m.route_resource :user_session
55
+ m.route_name('login', '/login', { :controller => 'user_sessions', :action => 'new' })
56
+ m.route_name('logout', '/logout', { :controller => 'user_sessions', :action => 'destroy' })
57
+ m.route_name('register', '/register/:activation_code', { :controller => 'activations', :action => 'new' }) unless options[:skip_activation]
58
+ end
59
+
60
+ unless options[:skip_migration]
61
+ m.migration_template "migrate/create_users_and_sessions.rb", "db/migrate", :migration_file_name => "create_users_and_sessions" unless options[:skip_migration]
62
+ end
63
+
64
+ end
65
+
66
+ puts "\n1) Please add these lines to your ApplicationController\n\ninclude AuthlogicUser\nfilter_parameter_logging :password, :password_confirmation\nhelper_method :current_user_session, :current_user\n\n"
67
+ puts "2) Please add these lines to your environment and launch rake gems:install\n\nconfig.gem 'binarylogic-authlogic', :lib => 'authlogic', :source => 'http://gems.github.com'\n\n"
68
+ puts "3) Please remember to launch rake db:migrate\n\n" unless options[:skip_migration]
69
+
70
+ recorded_session
71
+ end
72
+
73
+ protected
74
+ def add_options!(opt)
75
+ opt.separator ''
76
+ opt.separator 'Options:'
77
+ opt.on("--skip-activation", "Don't generate activation views and controller.") { |v| options[:skip_activation] = true }
78
+ opt.on("--skip-password-reset", "Don't generate controller and views for password resetting.") { |v| options[:skip_password_reset] = true }
79
+ opt.on("--skip-migration", "Don't generate a migration file for this model.") { |v| options[:skip_migration] = true }
80
+ opt.on("--skip-routes", "Don't add lines to the route file.") { |v| options[:skip_routes] = true }
81
+ end
82
+ end
@@ -0,0 +1,45 @@
1
+ Rails::Generator::Commands::Create.class_eval do
2
+ def route_resources(*resources)
3
+ write_route 'resources', resources
4
+ end
5
+
6
+ def route_resource(*resources)
7
+ write_route 'resource', resources
8
+ end
9
+
10
+ def route_name(name, path, options={})
11
+ write_route nil, nil, name, path, options
12
+ end
13
+ end
14
+
15
+ Rails::Generator::Commands::Destroy.class_eval do
16
+ def route_resource(*resources)
17
+ remove_route look_for, 'resource', resource_list
18
+ end
19
+
20
+ def route_resource(*resources)
21
+ remove_route look_for, 'resource', resource_list
22
+ end
23
+
24
+ def route_name(name, path, options = {})
25
+ remove_route look_for, nil, nil, name, path, options
26
+ end
27
+ end
28
+
29
+ def write_route(type=nil, resources=nil, name=nil, path=nil, options={})
30
+ resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') if name.nil?
31
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
32
+ logger.route name.nil? ? "map.#{type} #{resource_list}" : "map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
33
+ unless options[:pretend]
34
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
35
+ name.nil? ? "#{match}\n map.#{type} #{resource_list}" : "#{match}\n map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
36
+ end
37
+ end
38
+ end
39
+
40
+ def remove_route(look_for, type=nil, resource_list=nil, name=nil, path=nil, options={})
41
+ resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') if name.nil?
42
+ look_for = name.nil? ? "\n map.resources #{resource_list}\n" : "\n map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
43
+ logger.route name.nil? ? "map.#{type} #{resource_list}" : "map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
44
+ gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
45
+ end
@@ -0,0 +1,17 @@
1
+ class ActivationsController < ApplicationController
2
+ before_filter :require_no_user
3
+
4
+ def new
5
+ @user = User.find_using_perishable_token(params[:activation_code], 100.year)
6
+ if !@user.nil? && !@user.active? && @user.activate!
7
+ @user.deliver_activation_confirmation!
8
+ UserSession.create(@user)
9
+ flash[:notice] = "Account activated!"
10
+ redirect_to root_url
11
+ else
12
+ flash[:error] = "Account can't be activated!"
13
+ redirect_to new_user_session_path
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,58 @@
1
+ class PasswordResetsController < ApplicationController
2
+ before_filter :load_user_using_perishable_token, :only => [:show, :update]
3
+ before_filter :require_no_user
4
+
5
+ def index
6
+ end
7
+
8
+ def create
9
+ @user = User.find_by_email(params[:email])
10
+ <% if options[:skip_activation] %>
11
+ if @user
12
+ <% else %>
13
+ if @user && @user.active?
14
+ <% end %>
15
+ @user.deliver_password_reset_instructions!
16
+ flash[:notice] = "Instructions to reset your password have been emailed to you. " +
17
+ "Please check your email."
18
+ redirect_to new_user_session_path
19
+ <% if options[:skip_activation] %>
20
+ elsif @user && !@user.active?
21
+ @user.deliver_activation_instructions!
22
+ flash[:error] = 'Activation needed'
23
+ render :action => 'activate'
24
+ <% end %>
25
+ else
26
+ flash[:notice] = "No user was found with that email address."
27
+ render :action => :index
28
+ end
29
+
30
+ end
31
+
32
+ def show
33
+ end
34
+
35
+ def update
36
+ @user.password = params[:user][:password]
37
+ @user.password_confirmation = params[:user][:password_confirmation]
38
+ if @user.changed? && @user.save
39
+ flash[:notice] = "Password successfully updated"
40
+ redirect_to user_path(@user)
41
+ else
42
+ flash[:error] = 'Password not updated'
43
+ render :action => :show
44
+ end
45
+ end
46
+
47
+ private
48
+ def load_user_using_perishable_token
49
+ @user = User.find_using_perishable_token(params[:id])
50
+ unless @user
51
+ flash[:notice] = "We're sorry, but we could not locate your account." +
52
+ "If you are having issues try copying and pasting the URL " +
53
+ "from your email into your browser or restarting the " +
54
+ "reset password process."
55
+ redirect_to root_url
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,26 @@
1
+ class UserSessionsController < ApplicationController
2
+ before_filter :require_no_user, :only => [:new, :create]
3
+ before_filter :require_user, :only => :destroy
4
+
5
+ def new
6
+ @user_session = UserSession.new
7
+ end
8
+
9
+ def create
10
+ @user_session = UserSession.new(params[:user_session])
11
+ if @user_session.save
12
+ flash[:notice] = "Login successful!"
13
+ redirect_back_or_default root_url
14
+ else
15
+ @user_session.errors.clear
16
+ flash[:error] = 'Login incorrect!'
17
+ render :action => :new
18
+ end
19
+ end
20
+
21
+ def destroy
22
+ current_user_session.destroy
23
+ flash[:notice] = "Logout successful!"
24
+ redirect_back_or_default new_user_session_path
25
+ end
26
+ end
@@ -0,0 +1,66 @@
1
+ class UsersController < ApplicationController
2
+ before_filter :require_no_user, :only => [:new, :create]
3
+ before_filter :require_user, :only => [:show, :edit, :update, :index]
4
+
5
+ def new
6
+ @user = User.new
7
+ end
8
+
9
+ def create
10
+ <% if options[:skip_activation] -%>
11
+ @user = User.new(params[:user])
12
+ if @user.save
13
+ flash[:notice] = "Your account has been created!"
14
+ redirect_to user_path(@user)
15
+ else
16
+ flash[:error] = "User already exists!"
17
+ render :action => :new
18
+ end
19
+ <% else -%>
20
+ @user = User.find_by_email(params[:user][:email]) || User.new(params[:user])
21
+ if @user.active?
22
+ flash[:error] = "User already exists and has been activated."
23
+ render :action => :new
24
+ else
25
+ @user.attributes = params[:user] unless @user.new_record?
26
+ if @user.save_without_session_maintenance
27
+ @user.deliver_activation_instructions!
28
+ flash[:notice] = "Your account has been created. Please check your e-mail for your account activation instructions!"
29
+ redirect_to new_user_session_path
30
+ else
31
+ render :action => :new
32
+ end
33
+ end
34
+ <% end %>
35
+ end
36
+
37
+ def show
38
+ @user = User.find(params[:id])
39
+ <% unless options[:skip_activation] %>
40
+ raise ActiveRecord::RecordNotFound unless @user.active?
41
+ <% end %>
42
+ respond_to do |format|
43
+ format.html {
44
+ if @user == @current_user
45
+ render :action => 'private'
46
+ else
47
+ render :action => 'public'
48
+ end
49
+ }
50
+ end
51
+ end
52
+
53
+ def edit
54
+ @user = @current_user
55
+ end
56
+
57
+ def update
58
+ @user = @current_user
59
+ if @user.update_attributes(params[:user])
60
+ flash[:notice] = "Account updated!"
61
+ redirect_to user_url
62
+ else
63
+ render :action => :edit
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,40 @@
1
+ module AuthlogicUser
2
+
3
+ def current_user_session
4
+ return @current_user_session if defined?(@current_user_session)
5
+ @current_user_session = UserSession.find
6
+ end
7
+
8
+ def current_user
9
+ return @current_user if defined?(@current_user)
10
+ @current_user = current_user_session && current_user_session.user
11
+ end
12
+
13
+ def require_user
14
+ unless current_user
15
+ store_location
16
+ flash[:notice] = "You must be logged in to access this page"
17
+ redirect_to new_user_session_url
18
+ return false
19
+ end
20
+ end
21
+
22
+ def require_no_user
23
+ if current_user
24
+ store_location
25
+ flash[:notice] = "You must be logged out to access this page"
26
+ redirect_to root_url
27
+ return false
28
+ end
29
+ end
30
+
31
+ def store_location
32
+ session[:return_to] = request.request_uri
33
+ end
34
+
35
+ def redirect_back_or_default(default)
36
+ redirect_to(session[:return_to] || default)
37
+ session[:return_to] = nil
38
+ end
39
+
40
+ end
@@ -0,0 +1,39 @@
1
+ class CreateUsersAndSessions < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :sessions do |t|
4
+ t.string :session_id, :null => false
5
+ t.text :data
6
+ t.timestamps
7
+ end
8
+
9
+ add_index :sessions, :session_id
10
+ add_index :sessions, :updated_at
11
+
12
+ create_table :users do |t|
13
+ t.string :email, :null => false
14
+ t.string :crypted_password, :null => false # optional
15
+ t.string :password_salt, :null => false # optional, but highly recommended
16
+ t.string :persistence_token, :null => false # required
17
+ t.string :single_access_token, :null => false # optional, see Authlogic::Session::Params
18
+ t.string :perishable_token, :null => false # optional, see Authlogic::Session::PerishableToken
19
+
20
+ # Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
21
+ t.integer :failed_login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
22
+ t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
23
+ t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
24
+ t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
25
+ t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
26
+ <% unless options[:skip_activation] %>
27
+ t.boolean :active # optional, needed for user activation
28
+ <% end %>
29
+ t.timestamps
30
+ end
31
+
32
+ add_index :users, :email
33
+ end
34
+
35
+ def self.down
36
+ drop_table :sessions
37
+ drop_table :users
38
+ end
39
+ end
@@ -0,0 +1,33 @@
1
+ class Notifier < ActionMailer::Base
2
+ default_url_options[:host] = "localhost:3000"
3
+
4
+ <% unless options[:skip_password_reset] %>
5
+ def password_reset_instructions(user)
6
+ subject "Password Reset Instructions"
7
+ from "Develon Notifier <noreply@develon.com>"
8
+ recipients user.email
9
+ sent_on Time.now
10
+ body :edit_password_reset_url => password_reset_url(user.perishable_token)
11
+ end
12
+ <% end %>
13
+
14
+ <% unless options[:skip_activation] %>
15
+ def activation_instructions(user)
16
+ subject "Activation Instructions"
17
+ from "Develon Notifier <noreply@develon.com>"
18
+ recipients user.email
19
+ sent_on Time.now
20
+ body :account_activation_url => register_url(user.perishable_token)
21
+ end
22
+ <% end %>
23
+
24
+ def activation_confirmation(user)
25
+ subject "Activation Complete"
26
+ from "Develon Notifier <noreply@develon.com>"
27
+ recipients user.email
28
+ sent_on Time.now
29
+ body :root_url => root_url
30
+ end
31
+
32
+
33
+ end
@@ -0,0 +1,29 @@
1
+ class User < ActiveRecord::Base
2
+ acts_as_authentic
3
+
4
+ <% unless options[:skip_password_reset] %>
5
+ def deliver_password_reset_instructions!
6
+ reset_perishable_token!
7
+ Notifier.deliver_password_reset_instructions(self)
8
+ end
9
+ <% end %>
10
+
11
+ <% unless options[:skip_activation] %>
12
+ def deliver_activation_instructions!
13
+ reset_perishable_token!
14
+ Notifier.deliver_activation_instructions(self)
15
+ end
16
+
17
+ def activate!
18
+ self.active = true
19
+ self.save
20
+ end
21
+ <% end %>
22
+
23
+ def deliver_activation_confirmation!
24
+ reset_perishable_token!
25
+ Notifier.deliver_activation_confirmation(self)
26
+ end
27
+
28
+
29
+ end
@@ -0,0 +1,3 @@
1
+ class UserSession < Authlogic::Session::Base
2
+ consecutive_failed_logins_limit 10
3
+ end
@@ -0,0 +1,8 @@
1
+ <h1>Activate your account</h1>
2
+
3
+ <% form_for @user, :url => activate_path(@user.id), :html => { :method => :post } do |f| %>
4
+ <%= f.error_messages %>
5
+ <p class="submit">
6
+ <%= f.submit "Activate" %>
7
+ </p>
8
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <div id="user_nav">
2
+ <%% if current_user %>
3
+ <%%= link_to "My personal homepage", user_path(current_user) %> |
4
+ <%%= link_to "Edit my Profile", edit_user_path(:current) %> |
5
+ <%%= link_to "Logout", logout_path %>
6
+ <%% else %>
7
+ <%%= link_to "Register", new_user_path %> |
8
+ <%%= link_to "Login", login_path %>
9
+ <% unless options[:skip_password_reset] %>
10
+ | <%%= link_to "Forgot Password", password_resets_path %>
11
+ <% end %>
12
+ <%% end %>
13
+ </div>
@@ -0,0 +1,5 @@
1
+ Your account has been activated.
2
+
3
+ <%= @root_url %>
4
+
5
+ If the above URL does not work try copying and pasting it into your browser. If you continue to have problem, please feel free to contact us.
@@ -0,0 +1,5 @@
1
+ Your account has been activated.
2
+
3
+ <%= @root_url %>
4
+
5
+ If the above URL does not work try copying and pasting it into your browser. If you continue to have problem, please feel free to contact us.
@@ -0,0 +1,5 @@
1
+ Thank you for creating an account! Click the url below to activate your account!
2
+
3
+ <%= @account_activation_url %>
4
+
5
+ If the above URL does not work try copying and pasting it into your browser. If you continue to have problem, please feel free to contact us.
@@ -0,0 +1,5 @@
1
+ Thank you for creating an account! Click the url below to activate your account!
2
+
3
+ <%= @account_activation_url %>
4
+
5
+ If the above URL does not work try copying and pasting it into your browser. If you continue to have problem, please feel free to contact us.
@@ -0,0 +1,5 @@
1
+ A request to reset your password has been made. If you did not make this request, simply ignore this email. If you did make this request just click the link below:
2
+
3
+ <%= @edit_password_reset_url %>
4
+
5
+ If the above URL does not work try copying and pasting it into your browser. If you continue to have problem please feel free to contact us.
@@ -0,0 +1,5 @@
1
+ A request to reset your password has been made. If you did not make this request, simply ignore this email. If you did make this request just click the link below:
2
+
3
+ <%= @edit_password_reset_url %>
4
+
5
+ If the above URL does not work try copying and pasting it into your browser. If you continue to have problem please feel free to contact us.
@@ -0,0 +1,2 @@
1
+ Your account must be activated in order to access these pages.
2
+ An email has been sent to you to start activation process.
@@ -0,0 +1,14 @@
1
+ <h1>Forgot Password</h1>
2
+
3
+ Fill out the form below and instructions to reset your password will be emailed to you:<br />
4
+ <br />
5
+
6
+ <% form_tag password_resets_path do %>
7
+ <p class="email">
8
+ <%= label_tag :email, "Email" %><br />
9
+ <%= text_field_tag :email %>
10
+ </p>
11
+ <p class="submit">
12
+ <%= submit_tag "Reset my password" %>
13
+ </p>
14
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <h1>Change My Password</h1>
2
+
3
+ <% form_for @user, :url => password_reset_path(@user.perishable_token), :method => :put do |f| %>
4
+ <p class="password">
5
+ <%= f.label :password %><br />
6
+ <%= f.password_field :password %>
7
+ </p>
8
+ <p class="password_confirmation">
9
+ <%= f.label :password_confirmation %><br />
10
+ <%= f.password_field :password_confirmation %>
11
+ </p>
12
+ <p class="submit">
13
+ <%= f.submit "Update my password and log me in" %>
14
+ </p>
15
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <h1>Login</h1>
2
+
3
+ <% form_for @user_session, :url => user_session_path do |f| %>
4
+ <%= f.error_messages %>
5
+ <p class="email">
6
+ <%= f.label :email %><br />
7
+ <%= f.text_field :email %>
8
+ </p>
9
+ <p class="password">
10
+ <%= f.label :password %><br />
11
+ <%= f.password_field :password %>
12
+ </p>
13
+ <p class="remember_me">
14
+ <%= f.check_box :remember_me %><%= f.label :remember_me %>
15
+ </p>
16
+ <p class="sumbit">
17
+ <%= f.submit "Login" %>
18
+ </p>
19
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <p class="email">
2
+ <%= form.label :email %><br />
3
+ <%= form.text_field :email %>
4
+ </p>
5
+ <p class="password">
6
+ <%= form.label :password, form.object.new_record? ? nil : "Change password" %><br />
7
+ <%= form.password_field :password %>
8
+ </p>
9
+ <p class="password_confirmation">
10
+ <%= form.label :password_confirmation %><br />
11
+ <%= form.password_field :password_confirmation %>
12
+ </p>
@@ -0,0 +1,9 @@
1
+ <h1>Edit My Profile</h1>
2
+
3
+ <% form_for @user do |f| %>
4
+ <%= f.error_messages %>
5
+ <%= render :partial => "form", :object => f %>
6
+ <p class="submit">
7
+ <%= f.submit "Update" %>
8
+ </p>
9
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <h1>Register</h1>
2
+
3
+ <% form_for @user do |f| %>
4
+ <%= f.error_messages %>
5
+ <%= render :partial => "form", :object => f %>
6
+ <p class="submit">
7
+ <%= f.submit "Register" %>
8
+ </p>
9
+ <% end %>
@@ -0,0 +1,27 @@
1
+ <h1>
2
+ My Personal homepage
3
+ </h1>
4
+ <p class="email">
5
+ <b>Email:</b>
6
+ <%=h @user.email %>
7
+ </p>
8
+
9
+ <p class="last_login">
10
+ <b>Last login at:</b>
11
+ <%=h @user.last_login_at %>
12
+ </p>
13
+
14
+ <p class="current_login">
15
+ <b>Current login at:</b>
16
+ <%=h @user.current_login_at %>
17
+ </p>
18
+
19
+ <p class="last_login_ip">
20
+ <b>Last login ip:</b>
21
+ <%=h @user.last_login_ip %>
22
+ </p>
23
+
24
+ <p class="current_login_ip">
25
+ <b>Current login ip:</b>
26
+ <%=h @user.current_login_ip %>
27
+ </p>
@@ -0,0 +1,2 @@
1
+ # AuthlogicGenerator
2
+ require 'authlogic_generator'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: develon-authlogic_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Dal Grande
@@ -31,11 +31,38 @@ extensions: []
31
31
 
32
32
  extra_rdoc_files: []
33
33
 
34
- files: []
35
-
34
+ files:
35
+ - generators/authlogic_generator/authlogic_generator_generator.rb
36
+ - lib/authlogic_generator.rb
37
+ - generators/authlogic_generator/lib/insert_routes.rb
38
+ - generators/authlogic_generator/templates/controllers/activations_controller.rb
39
+ - generators/authlogic_generator/templates/controllers/password_resets_controller.rb
40
+ - generators/authlogic_generator/templates/controllers/user_sessions_controller.rb
41
+ - generators/authlogic_generator/templates/controllers/users_controller.rb
42
+ - generators/authlogic_generator/templates/lib/authlogic_user.rb
43
+ - generators/authlogic_generator/templates/migrate/create_users_and_sessions.rb
44
+ - generators/authlogic_generator/templates/models/notifier.rb
45
+ - generators/authlogic_generator/templates/models/user.rb
46
+ - generators/authlogic_generator/templates/models/user_session.rb
47
+ - generators/authlogic_generator/templates/views/activations/new.html.erb
48
+ - generators/authlogic_generator/templates/views/layouts/_usernav.html.erb
49
+ - generators/authlogic_generator/templates/views/notifier/activation_confirmation.text.html.erb
50
+ - generators/authlogic_generator/templates/views/notifier/activation_instructions.text.html.erb
51
+ - generators/authlogic_generator/templates/views/notifier/password_reset_instructions.text.html.erb
52
+ - generators/authlogic_generator/templates/views/notifier/activation_confirmation.text.plain.erb
53
+ - generators/authlogic_generator/templates/views/notifier/activation_instructions.text.plain.erb
54
+ - generators/authlogic_generator/templates/views/notifier/password_reset_instructions.text.plain.erb
55
+ - generators/authlogic_generator/templates/views/password_resets/activate.html.erb
56
+ - generators/authlogic_generator/templates/views/password_resets/index.html.erb
57
+ - generators/authlogic_generator/templates/views/password_resets/show.html.erb
58
+ - generators/authlogic_generator/templates/views/user_sessions/new.html.erb
59
+ - generators/authlogic_generator/templates/views/users/_form.html.erb
60
+ - generators/authlogic_generator/templates/views/users/edit.html.erb
61
+ - generators/authlogic_generator/templates/views/users/new.html.erb
62
+ - generators/authlogic_generator/templates/views/users/private.html.erb
63
+ - generators/authlogic_generator/templates/views/users/public.html.erb
36
64
  has_rdoc: true
37
65
  homepage: http://github.com/develon/authlogic_generator
38
- licenses:
39
66
  post_install_message:
40
67
  rdoc_options:
41
68
  - --inline-source
@@ -57,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
84
  requirements: []
58
85
 
59
86
  rubyforge_project: authlogic_generator
60
- rubygems_version: 1.3.5
87
+ rubygems_version: 1.2.0
61
88
  signing_key:
62
89
  specification_version: 2
63
90
  summary: This generator for authlogic creates models, controllers and view for authentication, user activation and password resetting.