LOGIN

I am developing an assignment for best ror practice.

For the same,

I am making a login & password form. It is something like that below

LOGIN.

Login : ______________

Password : ____________

Submit Register Forgot Password.

I have made this in view as in index.erb.html.

I want to check it in Controller,

HOw do I suppose to take the user value in Controller.

THe below is the code I wrote in index.erb.html..........

<h3>Login</h3> <%= form_tag :action => "login" %>    Login: <%= text_field "users", "name", :size => 20 %><br />    Password: <%= password_field "users", "hashed_password",:size => 20%><br />    <%= submit_tag "Submit" %>

  <%= link_to 'Register', :action => 'signup' %>     <%= link_to 'Forgot my password', :action => 'forgot_password' %>

My table with name users in db has following attributes.

users

Hunt Hunt wrote:

<h3>Login</h3> <%= form_tag :action => "login" %>    Login: <%= text_field "users", "name", :size => 20 %><br />    Password: <%= password_field "users", "hashed_password",:size => 20%><br />    <%= submit_tag "Submit" %>

  <%= link_to 'Register', :action => 'signup' %>     <%= link_to 'Forgot my password', :action => 'forgot_password' %>

My table with name users in db has following attributes.

users -------------------------------------------- user | hased_password | email | created_at |

Hunt, first thing, hashed_password is spelled incorrectly in your db..

As you currently have it stated in your form, the way to retrieve it within your controller would be

user_params = params[:user]

def hash_algorithim(password) { #hash your password here }

user = User.new(:user => user_params[:name], :hashed_password => hash_algorithim(user_params[:hashed_password]))

hth ilan