Fix logic update form

parent aaab73c8
Pipeline #920 failed with stages
in 0 seconds
class UsersController < ApplicationController
before_action :signed_in_user, only: [:update, :my_page, :my_info]
before_action :sign_in_validation, only: [:update, :my_page, :my_info]
def my_page
end
......@@ -7,7 +7,7 @@ class UsersController < ApplicationController
end
def update
user_params[:password] = current_user.password_digest if user_params[:password].nil?
user_params[:password] = current_user.password_digest if user_params[:password].blank?
if BCrypt::Password.new(current_user.password_digest) != condition_update[:oldpassword]
flash.now[:danger] = 'Old Password is mismatch'
else
......@@ -24,11 +24,14 @@ class UsersController < ApplicationController
private
def signed_in_user
unless signed_in?
flash[:warning] = "Please Sign In..."
redirect_to login_path
end
def validate_oldpass
end
def sign_in_validation
return if signed_in?
flash[:warning] = "Please Sign In..."
redirect_to login_path
end
def user_params
......
......@@ -19,7 +19,7 @@ class User < ApplicationRecord
validates :password, allow_nil: true, length: { minimum: 6, too_short: "is blank or too short" }
def User.new_remember_token
def self.new_remember_token
SecureRandom.urlsafe_base64
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment