Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
warm_city
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mykhailo Makohin
warm_city
Commits
622b829e
Commit
622b829e
authored
Sep 19, 2019
by
Mykhailo Makohin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some changes in redirect if user not logged in
parent
14065b26
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
sessions_controller.rb
app/controllers/users/sessions_controller.rb
+19
-0
users_controller.rb
app/controllers/users_controller.rb
+1
-1
application.html.haml
app/views/layouts/application.html.haml
+1
-1
routes.rb
config/routes.rb
+1
-1
No files found.
app/controllers/users/sessions_controller.rb
0 → 100644
View file @
622b829e
class
Users
::
SessionsController
<
Devise
::
SessionsController
def
new
super
end
def
create
auth_options
=
{
:recall
=>
"
#{
'home#index'
}
"
}
self
.
resource
=
warden
.
authenticate!
(
auth_options
)
set_flash_message
(
:notice
,
:signed_in
)
if
is_navigational_format?
sign_in
(
resource_name
,
resource
)
if
!
session
[
:return_to
].
blank?
redirect_to
session
[
:return_to
]
session
[
:return_to
]
=
nil
else
respond_with
resource
,
:location
=>
after_sign_in_path_for
(
resource
)
end
end
end
\ No newline at end of file
app/controllers/users_controller.rb
View file @
622b829e
class
UsersController
<
ApplicationController
class
UsersController
<
ApplicationController
# skip_before_filter :verify_authenticity_token
before_filter
:authenticate_user!
def
index
def
index
@users
=
collection
@users
=
collection
...
...
app/views/layouts/application.html.haml
View file @
622b829e
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
%link
{
:href
=>
"favicons/apple-touch-icon180.png"
,
:rel
=>
"apple-touch-icon"
,
:sizes
=>
"180x180"
}
%link
{
:href
=>
"favicons/apple-touch-icon180.png"
,
:rel
=>
"apple-touch-icon"
,
:sizes
=>
"180x180"
}
%body
%body
=
render
'partials/modal'
=
render
'partials/modal'
-
if
current_page?
(
root_path
)
-
if
current_page?
(
root_path
)
||
current_page?
(
'/users/sign_in'
)
=
render
'partials/black_header'
=
render
'partials/black_header'
-
else
-
else
=
render
'partials/white_header'
=
render
'partials/white_header'
...
...
config/routes.rb
View file @
622b829e
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
root
'home#index'
root
'home#index'
devise_for
:users
,
controllers:
{
omniauth_callbacks:
"users/omniauth_callbacks"
,
devise_for
:users
,
controllers:
{
omniauth_callbacks:
"users/omniauth_callbacks"
,
registrations:
"users"
,
sessions:
"users"
}
registrations:
"users"
,
sessions:
"users
/sessions
"
}
resources
:users
resources
:users
end
end
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