Guest User

Untitled

a guest
Mar 10th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. Processing AccountController#signup (for 127.0.0.1 at 2007-12-20 18:09:33) [POST]
  2. Session ID: 46da0030f3118e9779c510680faef151
  3. Parameters: {"commit"=>"Create Account", "number"=>"+4793441707", "action"=>"signup", "controller"=>"account", "email"=>"martin@gmail.com"}
  4. User Columns (0.002021) SHOW FIELDS FROM users
  5. number is +4793441707 password: "printeni"
  6.  
  7. SQL (0.000306) BEGIN
  8. SQL (0.000421) INSERT INTO users (`company`, `messages_sent`, `name`, `salt`, `hashed_password`, `number`, `times_logged_in`, `credit`, `email`,
  9. `member_since`) VALUES(NULL, NULL, '+4793441707', '234562837785000.0563922371980976', '2dfbb5232d51bac57e1139c1d627fc3048c112ec', '+4793441707', NULL,
  10. NULL, 'martin@stabenfeldt.net', NULL)
  11. SQL (0.001679) COMMIT
  12. Sending to 4793441707: 0|IN_PROGRESS|57793061
  13.  
  14.  
  15. #<ActiveRecord::Errors:0x2aaaaeebabd0 @base=#<User:0x2aaaaeecbb88 @errors=#<ActiveRecord::Errors:0x2aaaaeebabd0 ...>, @password="\"printeni\"",
  16. @attributes={"messages_sent"=>nil, "salt"=>"234562837785000.0563922371980976", "company"=>nil, "name"=>"+4793441707", "times_logged_in"=>nil,
  17. "hashed_password"=>"2dfbb5232d51bac57e1139c1d627fc3048c112ec", "number"=>"+4793441707", "credit"=>nil, "id"=>5, "member_since"=>nil,
  18. "email"=>"martin@gmail.com"}, @password_confirmation="\"printeni\"", @new_record=false, @new_record_before_save=true>, @errors={}>
  19. Rendering within layouts/account
  20.  
  21. ## Controller and View:
  22. views/login.rhtml
  23. <fieldset>
  24. <legend>Please Log In</legend>
  25.  
  26. <% form_for :user do |form| %>
  27. <p>
  28. <label for="number">number:</label>
  29. <%= text_field_tag :number, params[:number] %>
  30. </p>
  31.  
  32. <p>
  33. <label for="password">Password:</label>
  34. <%= password_field_tag :password, params[:password] %>
  35. </p>
  36.  
  37. <p>
  38. <%= submit_tag "Login" %>
  39. </p>
  40. <% end %>
  41. </fieldset>
  42. </div>
  43.  
  44. controllers/account_controller.rb
  45. class AccountController < SmsController
  46.  
  47. def login
  48. session[:user_id] = nil
  49. if request.post?
  50. user = User.authenticate(params[:number], params[:password])
  51. if user
  52. session[:user_id] = user.id
  53. session[:user_name] = user.name
  54. uri = session[:original_uri]
  55. session[:original_uri] = nil
  56.  
  57. else
  58. flash[:notice] = "Invalid user/password combination"
  59. end
  60. end
  61. end
Add Comment
Please, Sign In to add comment