2011-03-07 02:40:29 +00:00
|
|
|
class PasswordsController < Devise::PasswordsController
|
|
|
|
def create
|
|
|
|
self.resource = resource_class.send_reset_password_instructions(params[resource_name])
|
|
|
|
if resource.errors.empty?
|
|
|
|
render(:json => {"success" => true})
|
|
|
|
else
|
2011-05-16 01:15:15 +00:00
|
|
|
render(:json => {"errors" => resource.errors}, :status => 500)
|
2011-03-07 02:40:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
self.resource = resource_class.new
|
|
|
|
resource.reset_password_token = params[:reset_password_token]
|
2011-08-30 03:50:03 +00:00
|
|
|
render("edit", :layout => "info_window")
|
2011-03-07 02:40:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
self.resource = resource_class.reset_password_by_token(params[resource_name])
|
2011-08-30 03:50:03 +00:00
|
|
|
redirect_to(:controller => "main", :action => "index")
|
2011-03-07 02:40:29 +00:00
|
|
|
end
|
|
|
|
end
|