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 @@
@import
"stylesheets/bootstrap.min.css"
;
@import
"stylesheets/font-awesome.css"
;
body
{
background
:
#eee
;
}
.footer
{
//position: absolute;
//bottom: 0;
...
...
app/controllers/registrations_controller.rb
View file @
d166e9de
...
...
@@ -9,20 +9,17 @@ class RegistrationsController < Devise::RegistrationsController
end
def
create
if
user_params
[
:step
].
to_
s
==
'1'
if
user_params
[
:step
].
to_
i
==
1
user
=
User
.
new
(
email:
user_params
[
:email
])
user
.
confirmation_token
=
Devise
.
friendly_token
user
.
skip_password_validation
=
true
respond_to
do
|
format
|
if
user
.
save
UserMailer
.
registration_confirmation
(
user
).
deliver
flash
[
:notice
]
=
'Please check your email to fisnish registering member'
format
.
html
{
redirect_to
register_path
(
step:
2
)
}
else
flash
[
:error
]
=
user
.
errors
.
full_messages
.
to_sentence
format
.
html
{
redirect_back
(
fallback_location:
root_path
)
}
end
user
.
skip_validation
=
true
# skip validation of name and password
if
user
.
save
UserMailer
.
registration_confirmation
(
user
).
deliver_later
flash
[
:notice
]
=
'Please check your email to fisnish registering member'
redirect_to
register_path
(
step:
2
)
else
flash
[
:error
]
=
user
.
errors
.
full_messages
.
to_sentence
redirect_back
(
fallback_location:
root_path
)
end
else
redirect_to
root_path
...
...
@@ -31,22 +28,15 @@ class RegistrationsController < Devise::RegistrationsController
def
complete_registering_user
user
=
User
.
find_by
(
confirmation_token:
user_params
[
:confirmation_token
])
user
.
name
=
user_params
[
:name
]
user
.
password
=
user_params
[
:password
]
user
.
password_confirmation
=
user_params
[
:password_confirmation
]
user
.
cv
=
user_params
[
:cv
]
respond_to
do
|
format
|
if
user
.
save
flash
[
:success
]
=
"Successfully created..."
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
user
.
attributes
=
user_params
if
user
.
save
flash
[
:success
]
=
"Successfully created..."
sign_in
(
user
)
redirect_to
after_sign_in_path_for
(
user
)
else
flash
[
:error
]
=
user
.
errors
.
full_messages
.
to_sentence
redirect_back
(
fallback_location:
root_path
)
end
end
private
...
...
app/models/user.rb
View file @
d166e9de
class
User
<
ApplicationRecord
attr_accessor
:skip_
password_
validation
attr_accessor
:skip_validation
before_save
->
{
skip_confirmation!
}
has_many
:apply_jobs
has_many
:applied_jobs
,
through: :apply_jobs
,
class_name:
'Job'
,
source: :job
...
...
@@ -16,16 +16,12 @@ class User < ApplicationRecord
# Validate
validates
:email
,
presence:
true
,
length:
{
maximum:
200
}
validates
:name
,
presence:
true
,
length:
{
maximum:
200
},
unless: :skip_
password_
validation
validate
:cv_size_validation
validates
:name
,
presence:
true
,
length:
{
maximum:
200
},
unless: :skip_validation
validate
s_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
"size should be less than 5MB"
private
def
password_required?
return
false
if
skip_
password_
validation
return
false
if
skip_validation
super
end
def
cv_size_validation
errors
[
:cv
]
<<
"size should be less than 5MB"
if
cv
.
size
>
5
.
megabytes
end
end
app/views/layouts/_menu.html.erb
View file @
d166e9de
...
...
@@ -18,7 +18,7 @@
<%-
else
-%>
<li><a
href=
"
<%=
new_user_session_path
%>
"
><i
class=
"fa fa-sign-in"
aria-hidden=
"true"
></i>
Login
</a></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
<%
end
%>
</li>
...
...
app/views/user_mailer/registration_confirmation.html.erb
View file @
d166e9de
...
...
@@ -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>
<%=
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>
app/views/users/registrations/new.html.erb
View file @
d166e9de
<div
class=
"row"
>
<div
class=
"container"
>
<h2>
Register
</h2>
<%-
if
@step
.
to_
s
==
'1'
-%>
<%-
if
@step
.
to_
i
==
1
-%>
<%=
render
"users/registrations/step1"
%>
<%-
elsif
@step
.
to_
s
==
'2'
-%>
<%-
elsif
@step
.
to_
i
==
2
-%>
<%=
render
"users/registrations/step2"
%>
<%-
elsif
@step
.
to_
s
==
'3'
-%>
<%-
elsif
@step
.
to_
i
==
3
-%>
<%=
render
"users/registrations/step3"
%>
<%-
end
-%>
</div>
...
...
config/environments/development.rb
View file @
d166e9de
...
...
@@ -51,14 +51,18 @@ Rails.application.configure do
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
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
=
{
address:
"smtp.gmail.com"
,
port:
587
,
domain:
"example.com"
,
authentication:
"plain"
,
enable_starttls_auto:
true
,
user_name:
ENV
[
"GMAIL_USER"
],
password:
ENV
[
"GMAIL_PASSWORD"
]
}
#
config.action_mailer.smtp_settings = {
#
address: "smtp.gmail.com",
#
port: 587,
#
domain: "example.com",
#
authentication: "plain",
#
enable_starttls_auto: true,
#
user_name: ENV["GMAIL_USER"],
#
password: ENV["GMAIL_PASSWORD"]
#
}
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