Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Huỳnh Thiên Phước
venjob
Commits
aaab73c8
Commit
aaab73c8
authored
Aug 17, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix my page, filtered password
parent
126a0b48
Pipeline
#918
failed with stages
in 0 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
6 deletions
+16
-6
app/assets/stylesheets/form_login.scss
+4
-0
app/controllers/users_controller.rb
+2
-1
app/models/user.rb
+1
-3
app/views/users/my_page.html.erb
+6
-0
config/application.rb
+1
-1
config/initializers/filter_parameter_logging.rb
+2
-1
No files found.
app/assets/stylesheets/form_login.scss
View file @
aaab73c8
...
@@ -20,4 +20,8 @@
...
@@ -20,4 +20,8 @@
#error_explanation
ul
li
{
#error_explanation
ul
li
{
color
:
red
;
color
:
red
;
}
}
.cv-none
{
font-style
:
italic
;
font-size
:
16px
;
}
app/controllers/users_controller.rb
View file @
aaab73c8
...
@@ -7,6 +7,7 @@ class UsersController < ApplicationController
...
@@ -7,6 +7,7 @@ class UsersController < ApplicationController
end
end
def
update
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
]
if
BCrypt
::
Password
.
new
(
current_user
.
password_digest
)
!=
condition_update
[
:oldpassword
]
flash
.
now
[
:danger
]
=
'Old Password is mismatch'
flash
.
now
[
:danger
]
=
'Old Password is mismatch'
else
else
...
@@ -31,7 +32,7 @@ class UsersController < ApplicationController
...
@@ -31,7 +32,7 @@ class UsersController < ApplicationController
end
end
def
user_params
def
user_params
params
.
require
(
:user
).
permit
(
:name
,
:email
,
:cv_user
)
params
.
require
(
:user
).
permit
(
:name
,
:email
,
:cv_user
,
:password
)
end
end
def
condition_update
def
condition_update
...
...
app/models/user.rb
View file @
aaab73c8
...
@@ -3,7 +3,6 @@ class User < ApplicationRecord
...
@@ -3,7 +3,6 @@ class User < ApplicationRecord
before_create
:create_remember_token
before_create
:create_remember_token
mount_uploader
:cv_user
,
UserCvUploader
mount_uploader
:cv_user
,
UserCvUploader
has_many
:favorite_jobs
has_many
:favorite_jobs
has_many
:jobs
,
through: :favorite_jobs
has_many
:jobs
,
through: :favorite_jobs
has_many
:job_applieds
has_many
:job_applieds
...
@@ -18,8 +17,7 @@ class User < ApplicationRecord
...
@@ -18,8 +17,7 @@ class User < ApplicationRecord
validates
:email
,
presence:
true
,
format:
{
with:
VALID_EMAIL_REGEX
},
validates
:email
,
presence:
true
,
format:
{
with:
VALID_EMAIL_REGEX
},
uniqueness:
{
case_sensitive:
false
}
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
def
User
.
new_remember_token
SecureRandom
.
urlsafe_base64
SecureRandom
.
urlsafe_base64
...
...
app/views/users/my_page.html.erb
View file @
aaab73c8
...
@@ -25,7 +25,13 @@
...
@@ -25,7 +25,13 @@
<%=
f
.
label
:cv_user
,
'My CV'
%>
<%=
f
.
label
:cv_user
,
'My CV'
%>
</div>
</div>
<div
class=
"col-8-sm"
>
<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
%>
<%=
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>
</div>
</div>
...
...
config/application.rb
View file @
aaab73c8
...
@@ -10,7 +10,7 @@ module Venjob
...
@@ -10,7 +10,7 @@ module Venjob
class
Application
<
Rails
::
Application
class
Application
<
Rails
::
Application
# Initialize configuration defaults for originally generated Rails version.
# Initialize configuration defaults for originally generated Rails version.
config
.
load_defaults
5.2
config
.
load_defaults
5.2
# config.filter_parameter_logging << :oldpassword, :password
# Settings in config/environments/* take precedence over those specified here.
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# -- all .rb files in that directory are automatically loaded after loading
...
...
config/initializers/filter_parameter_logging.rb
View file @
aaab73c8
# Be sure to restart your server when you modify this file.
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log 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
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment