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
2
Merge Requests
2
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
Thanh Hung Pham
veNJOB
Commits
7dc1c878
Commit
7dc1c878
authored
Jul 06, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
User information
parent
5e0dc4c1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
7 deletions
+26
-7
app/controllers/confirmations_controller.rb
+23
-1
app/controllers/registrations_controller.rb
+0
-4
app/views/devise/confirmations/information.html.erb
+2
-1
config/routes.rb
+1
-1
No files found.
app/controllers/confirmations_controller.rb
View file @
7dc1c878
class
ConfirmationsController
<
Devise
::
ConfirmationsController
def
update_confirm
@user
=
User
.
find
(
params
[
:id
])
if
@user
.
save
set_flash_message!
(
:notice
,
:confirmed
)
redirect_to
edit_user_registration_path
(
resource_name
,
resource
)
else
respond_with_navigational
(
resource
.
errors
,
status: :unprocessable_entity
){
render
:new
}
end
end
# GET /resource/confirmation?confirmation_token=abcdef
def
show
self
.
resource
=
resource_class
.
confirm_by_token
(
params
[
:confirmation_token
])
yield
resource
if
block_given?
if
resource
.
errors
.
empty?
set_flash_message!
(
:notice
,
:confirmed
)
respond_with_navigational
(
resource
){
render
'devise/confirmations/information'
,
resource:
resource
}
else
respond_with_navigational
(
resource
.
errors
,
status: :unprocessable_entity
){
render
:new
}
end
end
protected
def
after_confirmation_path_for
(
resource_name
,
resource
)
re
gistrations_information_path
(
resource
)
re
nder
'devise/confirmations/information'
,
resource:
resource
end
end
app/controllers/registrations_controller.rb
View file @
7dc1c878
class
RegistrationsController
<
Devise
::
RegistrationsController
def
information
render
'devise/registrations/information'
end
protected
def
after_sign_up_path_for
(
resource
)
...
...
app/views/devise/
registr
ations/information.html.erb
→
app/views/devise/
confirm
ations/information.html.erb
View file @
7dc1c878
...
...
@@ -2,12 +2,13 @@
<div
class=
"well"
>
<h2>
Register
</h2>
<%=
form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
html:
{
method: :pu
t
})
do
|
f
|
%>
<%=
form_for
(
resource
,
url:
confirmations_update_confirm_path
,
html:
{
method: :pos
t
})
do
|
f
|
%>
<%=
devise_error_messages!
%>
<div
class=
"form-group"
>
<%=
f
.
label
:email
%>
<%=
f
.
email_field
:email
,
autofocus:
true
,
class:
'form-control'
%>
<%=
f
.
hidden_field
:id
%>
</div>
<div
class=
"form-group"
>
...
...
config/routes.rb
View file @
7dc1c878
...
...
@@ -7,7 +7,7 @@ Rails.application.routes.draw do
resource
:cities
devise_scope
:user
do
get
'/registrations/information'
,
to:
'registrations#information
'
post
'/confirmations/update_confirm'
,
to:
'confirmations#update_confirm
'
end
devise_for
:users
,
controllers:
{
registrations:
'registrations'
,
confirmations:
'confirmations'
}
...
...
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