Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
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
VeNtura
rendezvous
Commits
8c44e50b
Commit
8c44e50b
authored
Feb 27, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ログイン時にアクセスURLへリダイレクト #18
parent
1f8218d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletions
+17
-1
app/controllers/application_controller.rb
+5
-0
app/controllers/users/omniauth_callbacks_controller.rb
+1
-1
spec/controllers/application_controller_spec.rb
+11
-0
No files found.
app/controllers/application_controller.rb
View file @
8c44e50b
...
...
@@ -6,10 +6,15 @@ class ApplicationController < ActionController::Base
def
require_login
unless
user_signed_in?
flash
[
:alert
]
=
'You need Login!'
session
[
:login_redirect_to
]
=
request
.
url
redirect_to
root_path
end
end
def
after_sign_in_path_for
(
resource
)
session
[
:login_redirect_to
]
||
request
.
env
[
'omniauth.origin'
]
||
stored_location_for
(
resource
)
||
root_path
end
rescue_from
(
ActionController
::
ParameterMissing
)
do
|
parameter_missing_exception
|
render
text:
"Required parameter missing:
#{
parameter_missing_exception
.
param
}
"
,
status: :bad_request
end
...
...
app/controllers/users/omniauth_callbacks_controller.rb
View file @
8c44e50b
...
...
@@ -3,7 +3,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
email
=
request
.
env
[
'omniauth.auth'
].
info
[
'email'
]
# reject if email is not zigexn nor ventura
# reject if email is not zigexn nor ventura
.
if
email
!~
/@zigexn\.co\.jp$/
&&
email
!~
/@zigexn\.vn$/
redirect_to
root_path
,
flash:
{
alert:
'Your email address is not permitted.'
}
return
...
...
spec/controllers/application_controller_spec.rb
0 → 100644
View file @
8c44e50b
require
'spec_helper'
describe
ApplicationController
do
pending
'#require_login'
pending
'#after_sign_in_path_for'
pending
'#rescue_from'
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