Sha256: da352c52d2ad86873010d0c7589ddbe1bb1f6ab695865e57ac5dbb71c8bb0340
Contents?: true
Size: 1020 Bytes
Versions: 59
Compression:
Stored size: 1020 Bytes
Contents
module Comee module Core class UsersController < ApplicationController include Common def change_password @user = current_user if @user.authenticate(change_password_params[:old_password]) if @user.update(password: change_password_params[:new_password], password_confirmation: change_password_params[:new_password_confirmation]) render json: {success: true, data: serialize(@user)} else render json: {success: false, error: @user.errors.full_messages[0]}, status: 422 end else render json: {success: false, error: "Old password doesn't match!"}, status: 422 end end private def change_password_params params.require(:payload).permit(:old_password, :new_password, :new_password_confirmation) end def model_params params.require(:payload).permit(:name, :email, :active, :password, :password_confirmation) end end end end
Version data entries
59 entries across 59 versions & 1 rubygems