Permalink
Browse files

Remove users routes other than auth

Removed routes and controller actions for
user update, index and show

Close #92
  • Loading branch information...
MicFin committed Oct 1, 2018
1 parent b3201e0 commit f218214ee1c748494b9cbce0257cca10ad03dc89
Showing with 0 additions and 27 deletions.
  1. +0 −26 app/controllers/users_controller.rb
  2. +0 −1 config/routes.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true

class UsersController < ProtectedController
before_action :set_user, only: %i[update show]
skip_before_action :authenticate, only: %i[signup signin]

# POST '/sign-up'
@@ -47,28 +46,8 @@ def changepw
end
end

def index
render json: User.all
end

def show
render json: @user
end

def update
if @user.update(user_params)
render json: @user
else
render json: @user.errors, status: :unprocessable_entity
end
end

private

def set_user
@user = User.find(params[:id])
end

def user_creds
params.require(:credentials)
.permit(:email, :password, :password_confirmation)
@@ -78,9 +57,4 @@ def pw_creds
params.require(:passwords)
.permit(:old, :new)
end

def user_params
params.require(:user)
.permit(:email)
end
end
@@ -3,7 +3,6 @@
Rails.application.routes.draw do
# RESTful routes
resources :examples, except: %i[new edit]
resources :users, only: %i[index show update]

# Custom routes
post '/sign-up' => 'users#signup'

0 comments on commit f218214

Please sign in to comment.