Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Processing AccountController#signup (for 127.0.0.1 at 2007-12-20 18:09:33) [POST]
- Session ID: 46da0030f3118e9779c510680faef151
- Parameters: {"commit"=>"Create Account", "number"=>"+4793441707", "action"=>"signup", "controller"=>"account", "email"=>"martin@gmail.com"}
- User Columns (0.002021) SHOW FIELDS FROM users
- number is +4793441707 password: "printeni"
- SQL (0.000306) BEGIN
- SQL (0.000421) INSERT INTO users (`company`, `messages_sent`, `name`, `salt`, `hashed_password`, `number`, `times_logged_in`, `credit`, `email`,
- `member_since`) VALUES(NULL, NULL, '+4793441707', '234562837785000.0563922371980976', '2dfbb5232d51bac57e1139c1d627fc3048c112ec', '+4793441707', NULL,
- NULL, 'martin@stabenfeldt.net', NULL)
- SQL (0.001679) COMMIT
- Sending to 4793441707: 0|IN_PROGRESS|57793061
- #<ActiveRecord::Errors:0x2aaaaeebabd0 @base=#<User:0x2aaaaeecbb88 @errors=#<ActiveRecord::Errors:0x2aaaaeebabd0 ...>, @password="\"printeni\"",
- @attributes={"messages_sent"=>nil, "salt"=>"234562837785000.0563922371980976", "company"=>nil, "name"=>"+4793441707", "times_logged_in"=>nil,
- "hashed_password"=>"2dfbb5232d51bac57e1139c1d627fc3048c112ec", "number"=>"+4793441707", "credit"=>nil, "id"=>5, "member_since"=>nil,
- "email"=>"martin@gmail.com"}, @password_confirmation="\"printeni\"", @new_record=false, @new_record_before_save=true>, @errors={}>
- Rendering within layouts/account
- ## Controller and View:
- views/login.rhtml
- <fieldset>
- <legend>Please Log In</legend>
- <% form_for :user do |form| %>
- <p>
- <label for="number">number:</label>
- <%= text_field_tag :number, params[:number] %>
- </p>
- <p>
- <label for="password">Password:</label>
- <%= password_field_tag :password, params[:password] %>
- </p>
- <p>
- <%= submit_tag "Login" %>
- </p>
- <% end %>
- </fieldset>
- </div>
- controllers/account_controller.rb
- class AccountController < SmsController
- def login
- session[:user_id] = nil
- if request.post?
- user = User.authenticate(params[:number], params[:password])
- if user
- session[:user_id] = user.id
- session[:user_name] = user.name
- uri = session[:original_uri]
- session[:original_uri] = nil
- else
- flash[:notice] = "Invalid user/password combination"
- end
- end
- end
Add Comment
Please, Sign In to add comment