summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/errors_controller.rb2
-rw-r--r--app/controllers/v1/users_controller.rb12
2 files changed, 12 insertions, 2 deletions
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index 6c659e6..d869ab5 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -2,9 +2,11 @@
class ErrorsController < ApplicationController
# 404
def not_found
+ render status: 404
end
# 500
def server_error
+ render status: 500
end
end
diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb
index bfa04fc..d57db6f 100644
--- a/app/controllers/v1/users_controller.rb
+++ b/app/controllers/v1/users_controller.rb
@@ -2,9 +2,9 @@ module V1
class UsersController < ApiController
include ControllerExtension::FetchUser
- before_filter :fetch_user, :only => [:update]
+ before_filter :fetch_user, :only => [:update, :destroy]
before_filter :require_admin, :only => [:index]
- before_filter :require_login, :only => [:index, :update]
+ before_filter :require_login, :only => [:index, :update, :destroy]
before_filter :require_registration_allowed, only: :create
respond_to :json
@@ -29,6 +29,14 @@ module V1
respond_with @user
end
+ def destroy
+ @user.account.destroy
+ if @user == current_user
+ logout
+ end
+ render :json => {'success' => 'user deleted'}
+ end
+
protected
def require_registration_allowed