# Login

**URL:** <https://www.ruby-forum.com/t/login/173347>\
**Category:** Rails\
**Created:** [August 7, 2009, 6:34am UTC](https://www.ruby-forum.com/t/login/173347 "2009-08-07T06:34:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hunt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/71e660/32.png) [@hunt](https://www.ruby-forum.com/u/hunt)\
**Post date:** [August 7, 2009, 6:34am UTC](https://www.ruby-forum.com/t/login/173347/1 "2009-08-07T06:34:32Z")

</div>

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…

### Login
\<%= form\_tag :action =\> "login" %\> Login: \<%= text\_field "users", "name", :size =\> 20 %\>  
 Password: \<%= password\_field "users", "hashed\_password",:size =\> 20%\>  
 \<%= 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 |

---

<div class="post-metadata">

**Author:** ![hunt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/71e660/32.png) [@hunt](https://www.ruby-forum.com/u/hunt)\
**Post date:** [August 7, 2009, 6:02pm UTC](https://www.ruby-forum.com/t/login/173347/2 "2009-08-07T18:02:47Z")

</div>

Hunt H. wrote:

> ### Login
> \<%= form\_tag :action =\> "login" %\> Login: \<%= text\_field "users", "name", :size =\> 20 %\>  
> Password: \<%= password\_field "users", "hashed\_password",:size =\> 20%\>  
> \<%= 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
