Wrap text
Report abuse
|
|
VIEW:
/user/info.rhtml:
|
My Info:
<%= link_to 'upload my headshot', { :action => :upload_headshot }, :class => 'logintext' %>
<%= link_to 'change my email address', { :action => :change_email }, :class => 'logintext' %>
<%= link_to_remote "change my password",
:url => { :action => 'change_password' },
:update => 'placement' %>
|
<%= render :partial => 'headshot' %>
|
User#change_password method:
def change_password
render :layout => false
return unless request.post?
if User.authenticate(current_user.username, params[:current_password])
if (params[:password] == params[:password_confirmation])
current_user.password_confirmation = params[:password_confirmation]
current_user.password = params[:password]
if current_user.save
reset_session
flash[:info] = "Password changed Please log back in"
redirect_to login_url
else
flash[:notice] = "Password not changed"
end
else
flash[:notice] = "Password mismatch"
@current_password = params[:current_password]
end
else
flash[:notice] = "Wrong password"
end
end
|