Fix my page, filtered password

parent 126a0b48
Pipeline #918 failed with stages
in 0 seconds
......@@ -20,4 +20,8 @@
#error_explanation ul li{
color: red;
}
.cv-none {
font-style: italic;
font-size: 16px;
}
......@@ -7,6 +7,7 @@ class UsersController < ApplicationController
end
def update
user_params[:password] = current_user.password_digest if user_params[:password].nil?
if BCrypt::Password.new(current_user.password_digest) != condition_update[:oldpassword]
flash.now[:danger] = 'Old Password is mismatch'
else
......@@ -31,7 +32,7 @@ class UsersController < ApplicationController
end
def user_params
params.require(:user).permit(:name, :email, :cv_user)
params.require(:user).permit(:name, :email, :cv_user, :password)
end
def condition_update
......
......@@ -3,7 +3,6 @@ class User < ApplicationRecord
before_create :create_remember_token
mount_uploader :cv_user, UserCvUploader
has_many :favorite_jobs
has_many :jobs, through: :favorite_jobs
has_many :job_applieds
......@@ -18,8 +17,7 @@ class User < ApplicationRecord
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
validates :password, length: { minimum: 6, too_short: "is blank or too short" }
validates :password, allow_nil: true, length: { minimum: 6, too_short: "is blank or too short" }
def User.new_remember_token
SecureRandom.urlsafe_base64
......
......@@ -25,7 +25,13 @@
<%= f.label :cv_user, 'My CV' %>
</div>
<div class="col-8-sm">
<% if current_user.cv_user.present? %>
<%= link_to current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier %>
<% else %>
<div class="cv-none">
Your CV doesn't have at present!
</div>
<% end %>
</div>
</div>
......
......@@ -10,7 +10,7 @@ module Venjob
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
# config.filter_parameter_logging << :oldpassword, :password
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
......
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
Rails.application.config.filter_parameters += [:password, :oldpassword]
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