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
Mai Hoang Thai Ha
VenJob
Commits
366e6533
Commit
366e6533
authored
Aug 23, 2021
by
Mai Hoang Thai Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed register
parent
7c9f8479
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
152 additions
and
98 deletions
+152
-98
app/controllers/application_controller.rb
+1
-1
app/controllers/users/confirmations_controller.rb
+2
-4
app/controllers/users/registrations_controller.rb
+9
-53
app/views/layouts/_header.html.slim
+1
-1
app/views/users/passwords/new.html.slim
+0
-27
app/views/users/registrations/edit.html.slim
+2
-11
app/views/users/registrations/infomation.html.slim
+63
-0
config/routes.rb
+5
-1
confirmation.html.slim
+69
-0
No files found.
app/controllers/application_controller.rb
View file @
366e6533
...
@@ -9,7 +9,7 @@ class ApplicationController < ActionController::Base
...
@@ -9,7 +9,7 @@ class ApplicationController < ActionController::Base
def
configure_permitted_parameters
def
configure_permitted_parameters
devise_parameter_sanitizer
.
permit
:sign_up
,
keys:
%i[name address phone email password]
devise_parameter_sanitizer
.
permit
:sign_up
,
keys:
%i[name address phone email password]
devise_parameter_sanitizer
.
permit
:account_update
,
keys:
%i[name email address phone password
current_password
]
devise_parameter_sanitizer
.
permit
:account_update
,
keys:
%i[name email address phone password]
end
end
private
private
...
...
app/controllers/users/confirmations_controller.rb
View file @
366e6533
...
@@ -2,9 +2,6 @@
...
@@ -2,9 +2,6 @@
class
Users
::
ConfirmationsController
<
Devise
::
ConfirmationsController
class
Users
::
ConfirmationsController
<
Devise
::
ConfirmationsController
# GET /resource/confirmation/new
# GET /resource/confirmation/new
# def new
# super
# end
# POST /resource/confirmation
# POST /resource/confirmation
# def create
# def create
...
@@ -19,7 +16,8 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
...
@@ -19,7 +16,8 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
protected
protected
def
after_confirmation_path_for
(
resource_name
,
resource
)
def
after_confirmation_path_for
(
resource_name
,
resource
)
sign_in
(
resource
)
token
=
resource
.
send
(
:set_reset_password_token
)
token
=
resource
.
send
(
:set_reset_password_token
)
edit_password_path
(
resource
,
reset_password_token:
token
)
signup_infomation_path
(
reset_password_token:
token
)
end
end
end
end
app/controllers/users/registrations_controller.rb
View file @
366e6533
...
@@ -4,59 +4,15 @@ class Users::RegistrationsController < Devise::RegistrationsController
...
@@ -4,59 +4,15 @@ class Users::RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]
# before_action :configure_account_update_params, only: [:update]
# GET /resource/sign_up
def
information
# def new
self
.
resource
=
resource_class
.
new
# super
signed_in_resource
# end
render
:infomation
end
# POST /resource
protected
# def create
# super
# end
# GET /resource/edit
def
update_resource
(
resource
,
params
)
# def edit
resource
.
update_without_password
(
params
)
# super
end
# end
# PUT /resource
# def update
# super
# end
# DELETE /resource
# def destroy
# super
# end
# GET /resource/cancel
# Forces the session data which is usually expired after sign
# in to be expired now. This is useful if the user wants to
# cancel oauth signing in/up in the middle of the process,
# removing all OAuth session data.
# def cancel
# super
# end
# protected
# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_up_params
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
# end
# If you have extra params to permit, append them to the sanitizer.
# def configure_account_update_params
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
# end
# The path used after sign up.
# def after_sign_up_path_for(resource)
# super(resource)
# end
# The path used after sign up for inactive accounts.
# def after_inactive_sign_up_path_for(resource)
# super(resource)
# end
end
end
app/views/layouts/_header.html.slim
View file @
366e6533
...
@@ -13,4 +13,4 @@ header.navbar.navbar-fixed-top.navbar-inverse
...
@@ -13,4 +13,4 @@ header.navbar.navbar-fixed-top.navbar-inverse
li
li
=
link_to
"Log in"
,
login_path
=
link_to
"Log in"
,
login_path
li
li
=
link_to
"Sign up"
,
new_user_registration
_path
=
link_to
"Sign up"
,
signup
_path
app/views/users/passwords/new.html.slim
deleted
100644 → 0
View file @
7c9f8479
-
provide
(
:title
,
'Forgot password'
)
.container
.row.justify-content-center
.col-6
h2
.text-center.my-5
|
Forgot password
=
form_for
(
resource
,
as:
resource_name
,
url:
password_path
(
resource_name
),
html:
{
method: :post
})
do
|
f
|
=
render
'users/shared/error_messages'
,
resource:
resource
.field.row.form-group.mb-4
.col-2
=
f
.
label
:email
,
class:
'form-label'
.col-10
=
f
.
email_field
:email
,
autofocus:
true
,
autocomplete:
'email'
,
class:
'form-control mb-2'
span
.form-msg
.actions.row.justify-content-end
.col-10.d-flex.justify-content-center
=
f
.
submit
'Confirm your email'
,
class:
'btn btn-primary w-75 my-4'
,
data:
{
disable_with:
false
}
javascript:
Validator
({
form
:
'#new_user'
,
errorSelector
:
'.form-msg'
,
rules
:
[
Validator
.
isRequired
(
'#user_email'
),
Validator
.
isEmail
(
'#user_email'
)
]
})
app/views/users/registrations/edit.html.slim
View file @
366e6533
...
@@ -55,12 +55,6 @@
...
@@ -55,12 +55,6 @@
.col-9
.col-9
=
f
.
password_field
:password_confirmation
,
autocomplete:
'new-password'
,
class:
'form-control mb-2'
=
f
.
password_field
:password_confirmation
,
autocomplete:
'new-password'
,
class:
'form-control mb-2'
span
.form-msg
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:current_password
,
class:
'form-label'
.col-9
=
f
.
password_field
:current_password
,
autocomplete:
'current-password'
,
class:
'form-control mb-2'
span
.form-msg
.actions.row.justify-content-end
.actions.row.justify-content-end
.col-9
.col-9
=
f
.
submit
'Done'
,
class:
'btn btn-primary w-50 my-4'
,
data:
{
disable_with:
false
}
=
f
.
submit
'Done'
,
class:
'btn btn-primary w-50 my-4'
,
data:
{
disable_with:
false
}
...
@@ -81,10 +75,6 @@ javascript:
...
@@ -81,10 +75,6 @@ javascript:
Validator
.
isEmail
(
'#user_email'
),
Validator
.
isEmail
(
'#user_email'
),
Validator
.
isRequired
(
'#user_name'
),
Validator
.
isRequired
(
'#user_name'
),
Validator
.
isRequired
(
'#user_address'
),
Validator
.
isRequired
(
'#user_address'
),
Validator
.
isRequired
(
'#user_phone'
),
Validator
.
isRequired
(
'#user_phone'
)
Validator
.
isRequired
(
'#user_current_password'
),
Validator
.
isConfirmed
(
'#user_password_confirmation'
,
function
()
{
return
document
.
querySelector
(
'#new_user #user_password'
).
value
;
},
'Those passwords didn’t match.'
),
]
]
})
})
\ No newline at end of file
app/views/users/registrations/infomation.html.slim
0 → 100644
View file @
366e6533
-
provide
(
:title
,
'Edit profile'
)
.container
.row.justify-content-center
.col-8
h2
.text-center.my-5
|
Register
=
resource_name
.
to_s
.
humanize
=
form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
html:
{
method: :put
})
do
|
f
|
=
render
'users/shared/error_messages'
,
resource:
resource
.field.row.mb-2.form-group
-
if
devise_mapping
.
confirmable?
&&
resource
.
pending_reconfirmation?
div
|
Currently waiting confirmation for:
=
resource
.
unconfirmed_email
.field.row.mb-2.form-group
.col-3
=
f
.
label
:name
,
class:
'form-label'
.col-9
=
f
.
text_field
:name
,
autofocus:
true
,
autocomplete:
'name'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:address
,
class:
'form-label'
.col-9
=
f
.
text_field
:address
,
autofocus:
true
,
autocomplete:
'address'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:phone
,
class:
'form-label'
.col-9
=
f
.
text_field
:phone
,
autofocus:
true
,
autocomplete:
'phone'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:password
,
class:
'form-label'
.col-9
=
f
.
password_field
:password
,
autocomplete:
'new-password'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:password_confirmation
,
class:
'form-label'
.col-9
=
f
.
password_field
:password_confirmation
,
autocomplete:
'new-password'
,
class:
'form-control mb-2'
span
.form-msg
.actions.row.justify-content-end
.col-9
=
f
.
submit
'Register'
,
class:
'btn btn-primary w-50 my-4'
,
data:
{
disable_with:
false
}
/ javascript:
Validator
({
form
:
'
#edit_user
',
errorSelector
:
'
.form-msg
',
rules
:
[
Validator
.isRequired
('
#user_email
'),
Validator
.isEmail
('
#user_email
'),
Validator
.isRequired
('
#user_name
'),
Validator
.isRequired
('
#user_address
'),
Validator
.isRequired
('
#user_phone
'),
Validator
.isRequired
('
#user_current_password
')
]
})
\ No newline at end of file
config/routes.rb
View file @
366e6533
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
devise_for
:users
,
controllers:
{
devise_for
:users
,
controllers:
{
sessions:
'users/sessions'
,
confirmations:
'users/confirmations'
sessions:
'users/sessions'
,
confirmations:
'users/confirmations'
,
registrations:
'users/registrations'
}
}
devise_scope
:user
do
devise_scope
:user
do
get
'/login'
,
to:
'devise/sessions#new'
,
as: :login
get
'/login'
,
to:
'devise/sessions#new'
,
as: :login
get
'/my/info'
,
to:
'devise/registrations#edit'
,
as: :edit_profile
get
'/my/info'
,
to:
'devise/registrations#edit'
,
as: :edit_profile
get
'/forgot_password'
,
to:
'devise/passwords#new'
,
as: :forgot_password
get
'/forgot_password'
,
to:
'devise/passwords#new'
,
as: :forgot_password
get
'/reset_password'
,
to:
'devise/passwords#edit'
,
as: :reset_password
get
'/reset_password'
,
to:
'devise/passwords#edit'
,
as: :reset_password
get
'/register/1'
,
to:
'devise/registrations#new'
,
as: :signup
get
'/register/3'
,
to:
'users/registrations#information'
,
as: :signup_infomation
end
end
root
'top#index'
root
'top#index'
...
...
confirmation.html.slim
0 → 100644
View file @
366e6533
-
provide
(
:title
,
'Edit profile'
)
.container
.row.justify-content-center
.col-8
h2
.text-center.my-5
|
Register
=
resource_name
.
to_s
.
humanize
=
form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
html:
{
method: :put
})
do
|
f
|
=
render
'users/shared/error_messages'
,
resource:
resource
.field.row.mb-2.form-group
.col-3
=
f
.
label
:email
,
class:
'form-label'
.col-9
=
f
.
email_field
:email
,
autofocus:
true
,
autocomplete:
'email'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
-
if
devise_mapping
.
confirmable?
&&
resource
.
pending_reconfirmation?
div
|
Currently waiting confirmation for:
=
resource
.
unconfirmed_email
.field.row.mb-2.form-group
.col-3
=
f
.
label
:name
,
class:
'form-label'
.col-9
=
f
.
text_field
:name
,
autofocus:
true
,
autocomplete:
'name'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:address
,
class:
'form-label'
.col-9
=
f
.
text_field
:address
,
autofocus:
true
,
autocomplete:
'address'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:phone
,
class:
'form-label'
.col-9
=
f
.
text_field
:phone
,
autofocus:
true
,
autocomplete:
'phone'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:password
,
class:
'form-label'
.col-9
=
f
.
password_field
:password
,
autocomplete:
'new-password'
,
class:
'form-control mb-2'
span
.form-msg
.field.row.mb-2.form-group
.col-3
=
f
.
label
:password_confirmation
,
class:
'form-label'
.col-9
=
f
.
password_field
:password_confirmation
,
autocomplete:
'new-password'
,
class:
'form-control mb-2'
span
.form-msg
.actions.row.justify-content-end
.col-9
=
f
.
submit
'Register'
,
class:
'btn btn-primary w-50 my-4'
,
data:
{
disable_with:
false
}
/ javascript:
Validator
({
form
:
'
#edit_user
',
errorSelector
:
'
.form-msg
',
rules
:
[
Validator
.isRequired
('
#user_email
'),
Validator
.isEmail
('
#user_email
'),
Validator
.isRequired
('
#user_name
'),
Validator
.isRequired
('
#user_address
'),
Validator
.isRequired
('
#user_phone
'),
Validator
.isRequired
('
#user_current_password
')
]
})
\ No newline at end of file
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