You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
class UsersController < ApplicationController
|
|
before_action :set_user, only: %i[update]
|
|
|
|
# GET /users or /users.json
|
|
def index
|
|
@users = User.all
|
|
end
|
|
|
|
def get_user_info
|
|
@user = current_user
|
|
end
|
|
|
|
|
|
|
|
|
|
# PATCH/PUT /users/1 or /users/1.json
|
|
def update
|
|
respond_to do |format|
|
|
if @user.update(user_params)
|
|
format.html { redirect_to user_url(@user), notice: "User was successfully updated." }
|
|
format.json { render :show, status: :ok, location: @user }
|
|
else
|
|
format.html { render :edit, status: :unprocessable_entity }
|
|
format.json { render json: @user.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
private
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_user
|
|
@user = User.find(params[:id])
|
|
end
|
|
|
|
# Only allow a list of trusted parameters through.
|
|
def user_params
|
|
params.require(:user).permit(:login, :password, :email, :salt, :nickname, :status, :last_login_on, :phone, :ID_number, :student_number)
|
|
end
|
|
end
|