correct user passwd and sent json to front-end

This commit is contained in:
Rueshyna 2012-11-30 15:17:29 +08:00 committed by chris
parent eb97d417bd
commit 8a7ae3f061
3 changed files with 8 additions and 18 deletions

View File

@ -1,26 +1,14 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, "form-type"=>"ajax_form" }) do |f| %> <%= form_for(resource, :as => resource_name, :url => users_passwd_path(resource_name), :html => { :method => :put, "form-type"=>"ajax_form" }) do |f| %>
<%= devise_error_messages! %> <div><%= f.submit "Update" %></div>
<div><%= f.label :email %><br /> <div><%= f.label :password %>
<%= f.email_field :email %></div>
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password %></div> <%= f.password_field :password %></div>
<div><%= f.label :password_confirmation %><br /> <div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div> <%= f.password_field :password_confirmation %></div>
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br /> <div><%= f.label :current_password %>
<%= f.password_field :current_password %></div> <%= f.password_field :current_password %></div>
<div><%= f.submit "Update" %></div>
<% end %> <% end %>
<!--<h3>Cancel my account</h3>
<p>Unhappy? <%#= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%#= link_to "Back", :back %>
-->

View File

@ -110,7 +110,6 @@ Devise.setup do |config|
# Turn scoped views on. Before rendering "sessions/new", it will first check for # Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you # "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views. # are using only default views.
# config.scoped_views = true
# Configure the default scope given to Warden. By default it's the first # Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes. # devise role declared in your routes.

View File

@ -1,5 +1,8 @@
Orbit::Application.routes.draw do Orbit::Application.routes.draw do
devise_for :users devise_for :users do
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
end
mount Resque::Server, :at => "/admin/resque" mount Resque::Server, :at => "/admin/resque"
# routes for sinatra app # routes for sinatra app