Hi I am trying to change a password from my DB,
adding a new user works.. login in as the new user also works.. to change the user password does not works right..
I basically using a bit of the login code with the new user code..
what I am trying to do..( I MUST use unix crypt no way I can change this unfortunately)
1. I need to check for the email and password and I add this to variables of course the password I need to encrypted from plain text before I check this..( I also do this when login in.. and works)
2. after that is true then I go ahead to try to change the password..
the issue? I seem to change it but after that I cant log in anymore.. so somehow the .crypt(salt) that I am using for login and creating the user is not working here.. Im a noob so please let me know what can this be.
I also cant seem to see anything on the development.log how can I see what is going on between the form and rails? with no eyes I cant troubleshoot.
old_password = params[:crypt_old].crypt(params[:crypt_old])
new_password = params[:crypt_new].crypt(params[:crypt_new])
username = params[:email]
auth2 = Users.find(:first, :conditions => [ "email = '%s' AND crypt = '%s'",username, old_password ])
redirect_to :action => 'si'
redirect_to :action => 'no'
------------- snip ------------------
<%= error_messages_for 'login' %>
<legend>Enter your email, your old and new password</legend>
<% form_tag :action => 'change_password' do %>
<%= text_field_tag :email %>
<label for="crypt_old">Old Password</label><br/>
<%= password_field_tag :crypt_old %>
<label for="crypt_new">New Password</label><br/>
<%= password_field_tag :crypt_new %>
<%= submit_tag "Login" %>
<% end %>