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
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xuan Trung Le
venjob
Commits
d166e9de
Commit
d166e9de
authored
Oct 20, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
bc1b104a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
49 deletions
+43
-49
app/assets/stylesheets/application.scss
+4
-0
app/controllers/registrations_controller.rb
+17
-27
app/models/user.rb
+4
-8
app/views/layouts/_menu.html.erb
+1
-1
app/views/user_mailer/registration_confirmation.html.erb
+1
-1
app/views/users/registrations/new.html.erb
+3
-3
config/environments/development.rb
+13
-9
public/uploads/tmp/1508401465-2340-0001-2771/VeNJOB.xlsx
+0
-0
No files found.
app/assets/stylesheets/application.scss
View file @
d166e9de
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
@import
"stylesheets/bootstrap.min.css"
;
@import
"stylesheets/bootstrap.min.css"
;
@import
"stylesheets/font-awesome.css"
;
@import
"stylesheets/font-awesome.css"
;
body
{
background
:
#eee
;
}
.footer
{
.footer
{
//position: absolute;
//position: absolute;
//bottom: 0;
//bottom: 0;
...
...
app/controllers/registrations_controller.rb
View file @
d166e9de
...
@@ -9,20 +9,17 @@ class RegistrationsController < Devise::RegistrationsController
...
@@ -9,20 +9,17 @@ class RegistrationsController < Devise::RegistrationsController
end
end
def
create
def
create
if
user_params
[
:step
].
to_
s
==
'1'
if
user_params
[
:step
].
to_
i
==
1
user
=
User
.
new
(
email:
user_params
[
:email
])
user
=
User
.
new
(
email:
user_params
[
:email
])
user
.
confirmation_token
=
Devise
.
friendly_token
user
.
confirmation_token
=
Devise
.
friendly_token
user
.
skip_password_validation
=
true
user
.
skip_validation
=
true
# skip validation of name and password
if
user
.
save
respond_to
do
|
format
|
UserMailer
.
registration_confirmation
(
user
).
deliver_later
if
user
.
save
flash
[
:notice
]
=
'Please check your email to fisnish registering member'
UserMailer
.
registration_confirmation
(
user
).
deliver
redirect_to
register_path
(
step:
2
)
flash
[
:notice
]
=
'Please check your email to fisnish registering member'
else
format
.
html
{
redirect_to
register_path
(
step:
2
)
}
flash
[
:error
]
=
user
.
errors
.
full_messages
.
to_sentence
else
redirect_back
(
fallback_location:
root_path
)
flash
[
:error
]
=
user
.
errors
.
full_messages
.
to_sentence
format
.
html
{
redirect_back
(
fallback_location:
root_path
)
}
end
end
end
else
else
redirect_to
root_path
redirect_to
root_path
...
@@ -31,22 +28,15 @@ class RegistrationsController < Devise::RegistrationsController
...
@@ -31,22 +28,15 @@ class RegistrationsController < Devise::RegistrationsController
def
complete_registering_user
def
complete_registering_user
user
=
User
.
find_by
(
confirmation_token:
user_params
[
:confirmation_token
])
user
=
User
.
find_by
(
confirmation_token:
user_params
[
:confirmation_token
])
user
.
name
=
user_params
[
:name
]
user
.
attributes
=
user_params
user
.
password
=
user_params
[
:password
]
if
user
.
save
user
.
password_confirmation
=
user_params
[
:password_confirmation
]
flash
[
:success
]
=
"Successfully created..."
user
.
cv
=
user_params
[
:cv
]
sign_in
(
user
)
redirect_to
after_sign_in_path_for
(
user
)
respond_to
do
|
format
|
else
if
user
.
save
flash
[
:error
]
=
user
.
errors
.
full_messages
.
to_sentence
flash
[
:success
]
=
"Successfully created..."
redirect_back
(
fallback_location:
root_path
)
sign_in
(
user
)
format
.
html
{
redirect_to
after_sign_in_path_for
(
user
)
}
# auto login after created successfully
else
flash
[
:error
]
=
user
.
errors
.
full_messages
.
to_sentence
format
.
html
{
redirect_back
(
fallback_location:
root_path
)
}
end
end
end
end
end
private
private
...
...
app/models/user.rb
View file @
d166e9de
class
User
<
ApplicationRecord
class
User
<
ApplicationRecord
attr_accessor
:skip_
password_
validation
attr_accessor
:skip_validation
before_save
->
{
skip_confirmation!
}
before_save
->
{
skip_confirmation!
}
has_many
:apply_jobs
has_many
:apply_jobs
has_many
:applied_jobs
,
through: :apply_jobs
,
class_name:
'Job'
,
source: :job
has_many
:applied_jobs
,
through: :apply_jobs
,
class_name:
'Job'
,
source: :job
...
@@ -16,16 +16,12 @@ class User < ApplicationRecord
...
@@ -16,16 +16,12 @@ class User < ApplicationRecord
# Validate
# Validate
validates
:email
,
presence:
true
,
length:
{
maximum:
200
}
validates
:email
,
presence:
true
,
length:
{
maximum:
200
}
validates
:name
,
presence:
true
,
length:
{
maximum:
200
},
unless: :skip_
password_
validation
validates
:name
,
presence:
true
,
length:
{
maximum:
200
},
unless: :skip_validation
validate
:cv_size_validation
validate
s_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
"size should be less than 5MB"
private
private
def
password_required?
def
password_required?
return
false
if
skip_
password_
validation
return
false
if
skip_validation
super
super
end
end
def
cv_size_validation
errors
[
:cv
]
<<
"size should be less than 5MB"
if
cv
.
size
>
5
.
megabytes
end
end
end
app/views/layouts/_menu.html.erb
View file @
d166e9de
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<%-
else
-%>
<%-
else
-%>
<li><a
href=
"
<%=
new_user_session_path
%>
"
><i
class=
"fa fa-sign-in"
aria-hidden=
"true"
></i>
Login
</a></li>
<li><a
href=
"
<%=
new_user_session_path
%>
"
><i
class=
"fa fa-sign-in"
aria-hidden=
"true"
></i>
Login
</a></li>
<li>
<li>
<%=
link_to
"/register/1"
do
%>
<%=
link_to
register_path
(
step:
1
)
do
%>
<i
class=
"fa fa-plus-circle"
aria-hidden=
"true"
></i>
Register
<i
class=
"fa fa-plus-circle"
aria-hidden=
"true"
></i>
Register
<%
end
%>
<%
end
%>
</li>
</li>
...
...
app/views/user_mailer/registration_confirmation.html.erb
View file @
d166e9de
...
@@ -3,5 +3,5 @@
...
@@ -3,5 +3,5 @@
<p>
By clicking on the following link, you are confirming your email address and agreeing to VeNJOB's Terms of Service.
</p>
<p>
By clicking on the following link, you are confirming your email address and agreeing to VeNJOB's Terms of Service.
</p>
<p>
<p>
<%=
link_to
"Click here"
,
"http://localhost:3000/register/3?code=
#{
@user
.
confirmation_token
}
"
,
class:
"btn btn-primary"
%>
<%=
link_to
"Click here"
,
register_url
(
step:
3
,
code:
@user
.
confirmation_token
)
,
class:
"btn btn-primary"
%>
</p>
</p>
app/views/users/registrations/new.html.erb
View file @
d166e9de
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"container"
>
<div
class=
"container"
>
<h2>
Register
</h2>
<h2>
Register
</h2>
<%-
if
@step
.
to_
s
==
'1'
-%>
<%-
if
@step
.
to_
i
==
1
-%>
<%=
render
"users/registrations/step1"
%>
<%=
render
"users/registrations/step1"
%>
<%-
elsif
@step
.
to_
s
==
'2'
-%>
<%-
elsif
@step
.
to_
i
==
2
-%>
<%=
render
"users/registrations/step2"
%>
<%=
render
"users/registrations/step2"
%>
<%-
elsif
@step
.
to_
s
==
'3'
-%>
<%-
elsif
@step
.
to_
i
==
3
-%>
<%=
render
"users/registrations/step3"
%>
<%=
render
"users/registrations/step3"
%>
<%-
end
-%>
<%-
end
-%>
</div>
</div>
...
...
config/environments/development.rb
View file @
d166e9de
...
@@ -51,14 +51,18 @@ Rails.application.configure do
...
@@ -51,14 +51,18 @@ Rails.application.configure do
# Use an evented file watcher to asynchronously detect changes in source code,
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# routes, locales, etc. This feature depends on the listen gem.
config
.
file_watcher
=
ActiveSupport
::
EventedFileUpdateChecker
config
.
file_watcher
=
ActiveSupport
::
EventedFileUpdateChecker
config
.
action_mailer
.
default_url_options
=
{
:protocol
=>
'http'
,
:host
=>
'localhost:3000'
}
config
.
action_mailer
.
delivery_method
=
:smtp
config
.
action_mailer
.
smtp_settings
=
{
address:
'localhost'
,
port:
1025
}
config
.
action_mailer
.
smtp_settings
=
{
#
config.action_mailer.smtp_settings = {
address:
"smtp.gmail.com"
,
#
address: "smtp.gmail.com",
port:
587
,
#
port: 587,
domain:
"example.com"
,
#
domain: "example.com",
authentication:
"plain"
,
#
authentication: "plain",
enable_starttls_auto:
true
,
#
enable_starttls_auto: true,
user_name:
ENV
[
"GMAIL_USER"
],
#
user_name: ENV["GMAIL_USER"],
password:
ENV
[
"GMAIL_PASSWORD"
]
#
password: ENV["GMAIL_PASSWORD"]
}
#
}
end
end
public/uploads/tmp/1508401465-2340-0001-2771/VeNJOB.xlsx
deleted
100644 → 0
View file @
bc1b104a
File deleted
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