Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.41 KB | None | 0 0
  1. uninitialized constant User::Authentication
  2.  
  3. undefined method `key?' for nil:NilClass
  4.  
  5. actionpack (3.2.1) lib/action_controller/metal/hide_actions.rb:36:in `visible_action?'
  6. actionpack (3.2.1) lib/action_controller/metal/hide_actions.rb:18:in `method_for_action'
  7. actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:14:in `method_for_action'
  8. actionpack (3.2.1) lib/action_controller/metal/compatibility.rb:61:in `method_for_action'
  9. actionpack (3.2.1) lib/abstract_controller/base.rb:115:in `process'
  10. actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
  11. actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
  12. actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  13. actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in action'
  14. actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
  15. actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
  16. actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
  17. journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  18. journey (1.0.4) lib/journey/router.rb:56:in `each'
  19. journey (1.0.4) lib/journey/router.rb:56:in `call'
  20. actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
  21. actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  22. rack (1.4.1) lib/rack/etag.rb:23:in `call'
  23. rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
  24. actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
  25. actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  26. actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
  27. rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
  28. rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
  29. actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
  30. activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
  31. activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
  32. actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  33. activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__960052277__call__392212310__callbacks'
  34. activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
  35. activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  36. activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
  37. actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  38. actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  39. actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  40. actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  41. actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  42. railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
  43. railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
  44. actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  45. rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  46. rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  47. activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  48. rack (1.4.1) lib/rack/lock.rb:15:in `call'
  49. actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
  50. railties (3.2.1) lib/rails/engine.rb:479:in `call'
  51. railties (3.2.1) lib/rails/application.rb:220:in `call'
  52. rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  53. railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
  54. rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  55. C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  56. C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  57. C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
  58.  
  59. class UsersController < ApplicationController
  60. # Be sure to include AuthenticationSystem in Application Controller instead
  61. include AuthenticatedSystem
  62.  
  63.  
  64. # render new.rhtml
  65. def new
  66. @user = User.new
  67. end
  68.  
  69. def create
  70. logout_keeping_session!
  71. @user = User.new(params[:user])
  72. success = @user && @user.save
  73. if success && @user.errors.empty?
  74. redirect_back_or_default('/', :notice => "Thanks for signing up! We're sending you an email with your activation code.")
  75. else
  76. flash.now[:error] = "We couldn't set up that account, sorry. Please try again, or contact an admin (link is above)."
  77. render :action => 'new'
  78. end
  79. end
  80.  
  81. def activate
  82. logout_keeping_session!
  83. user = User.find_by_activation_code(params[:activation_code]) unless params[:activation_code].blank?
  84. case
  85. when (!params[:activation_code].blank?) && user && !user.active?
  86. user.activate!
  87. redirect_to '/login', :notice => "Signup complete! Please sign in to continue."
  88. when params[:activation_code].blank?
  89. redirect_back_or_default('/', :flash => { :error => "The activation code was missing. Please follow the URL from your email." })
  90. else
  91. redirect_back_or_default('/', :flash => { :error => "We couldn't find a user with that activation code -- check your email? Or maybe you've already activated -- try signing in." })
  92. end
  93. end
  94.  
  95. def forgot
  96. if request.post?
  97. user = User.find_by_email(params[:user][:email])
  98.  
  99. respond_to do |format|
  100. if user
  101. user.create_reset_code
  102. flash[:notice] = "Reset code sent to #{user.email}"
  103.  
  104. format.html { redirect_to login_path }
  105. format.xml { render :xml => user.email, :status => :created }
  106. else
  107. flash[:error] = "#{params[:user][:email]} does not exist in system"
  108.  
  109. format.html { redirect_to login_path }
  110. format.xml { render :xml => user.email, :status => :unprocessable_entity }
  111. end
  112. end
  113.  
  114. end
  115. end
  116.  
  117. def reset
  118. @user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil?
  119. if request.post?
  120. if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
  121. self.current_user = @user
  122. @user.delete_reset_code
  123. flash[:notice] = "Password reset successfully for #{@user.email}"
  124. redirect_to root_url
  125. else
  126. render :action => :reset
  127. end
  128. end
  129. end
  130.  
  131. end
  132.  
  133. <h1>Sign up as a new user</h1>
  134. <% @user.password = @user.password_confirmation = nil %>
  135.  
  136. <%= error_messages_for :user %>
  137. <%= form_for :user, :url => users_path do |f| -%>
  138. <p><%= label_tag 'login' %><br/>
  139. <%= f.text_field :login %></p>
  140.  
  141. <p><%= label_tag 'email' %><br/>
  142. <%= f.text_field :email %></p>
  143.  
  144. <p><%= label_tag 'password' %><br/>
  145. <%= f.password_field :password %></p>
  146.  
  147. <p><%= label_tag 'password_confirmation', 'Confirm Password' %><br/>
  148. <%= f.password_field :password_confirmation %></p>
  149.  
  150. <p><%= submit_tag 'Sign up' %></p>
  151. <% end -%>
  152.  
  153. Blog::Application.routes.draw do
  154. resources :users
  155.  
  156. resource :session, :only => [:new, :create, :destroy]
  157.  
  158. match 'signup' => 'users#new', :as => :signup
  159.  
  160. match 'register' => 'users#create', :as => :register
  161.  
  162. match 'login' => 'sessions#new', :as => :login
  163.  
  164. match 'logout' => 'sessions#destroy', :as => :logout
  165.  
  166. match 'forgot', :controller => 'users', :action => 'forgot'
  167. match 'reset/:reset_code', :controller => 'users', :action => 'reset'
  168.  
  169. match '/activate/:activation_code' => 'users#activate', :as => :activate, :activation_code => nil
  170.  
  171. resources :posts do
  172. resources :comments
  173. end
  174.  
  175. (...)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement