2011-03-06 18:28:00 +00:00
|
|
|
class UsersController < Devise::RegistrationsController
|
|
|
|
respond_to :json
|
|
|
|
|
|
|
|
def create
|
|
|
|
build_resource
|
|
|
|
if resource.save
|
|
|
|
if resource.active?
|
|
|
|
sign_in(resource_name, resource)
|
|
|
|
else
|
|
|
|
expire_session_data_after_sign_in!
|
|
|
|
end
|
2011-03-07 02:40:29 +00:00
|
|
|
respond_with resource
|
2011-03-06 18:28:00 +00:00
|
|
|
else
|
|
|
|
clean_up_passwords(resource)
|
2011-03-07 02:40:29 +00:00
|
|
|
render(:json => {"errors" => resource.errors})
|
2011-03-06 18:28:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|