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
3723122c
Commit
3723122c
authored
Aug 30, 2019
by
Mykhailo Makohin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish facebook registration
parent
b972dd4e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
4 deletions
+22
-4
omniauth_callbacks_controller.rb
app/controllers/users/omniauth_callbacks_controller.rb
+1
-1
user.rb
app/models/user.rb
+2
-1
application.yml
config/application.yml
+15
-0
devise.rb
config/initializers/devise.rb
+3
-1
routes.rb
config/routes.rb
+1
-1
No files found.
app/controllers/omniauth_callbacks_controller.rb
→
app/controllers/
users/
omniauth_callbacks_controller.rb
View file @
3723122c
class
OmniauthCallbacksController
<
Devise
::
OmniauthCallbacksController
class
Users
::
OmniauthCallbacksController
<
Devise
::
OmniauthCallbacksController
def
facebook
@user
=
User
.
from_omniauth
(
request
.
env
[
"omniauth.auth"
])
...
...
app/models/user.rb
View file @
3723122c
...
...
@@ -2,9 +2,10 @@ class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise
:database_authenticatable
,
:registerable
,
:recoverable
,
:rememberable
,
:validatable
:recoverable
,
:rememberable
devise
:omniauthable
,
:omniauth_providers
=>
[
:facebook
]
def
self
.
new_with_session
(
params
,
session
)
super
.
tap
do
|
user
|
if
data
=
session
[
"devise.facebook_data"
]
&&
session
[
"devise.facebook_data"
][
"extra"
][
"raw_info"
]
...
...
config/application.yml
0 → 100644
View file @
3723122c
# Add configuration values here, as shown below.
#
# pusher_app_id: "2954"
# pusher_key: 7381a978f7dd7f9a1117
# pusher_secret: abdc3b896a0ffb85d373
# stripe_api_key: sk_test_2J0l093xOyW72XUYJHE4Dv2r
# stripe_publishable_key: pk_test_ro9jV5SNwGb1yYlQfzG17LHK
#
# production:
# stripe_api_key: sk_live_EeHnL644i6zo4Iyq4v1KdV9H
# stripe_publishable_key: pk_live_9lcthxpSIHbGwmdO941O1XVU
development
:
FACEBOOK_APP_ID
:
"
678588699322994"
FACEBOOK_APP_SECRET
:
"
fb6f9a67539d5b2bbdc2e2e47c7d64f2"
\ No newline at end of file
config/initializers/devise.rb
View file @
3723122c
...
...
@@ -296,5 +296,7 @@ Devise.setup do |config|
# When set to false, does not sign a user in automatically after their password is
# changed. Defaults to true, so a user is signed in automatically after changing a password.
# config.sign_in_after_change_password = true
config
.
omniauth
:facebook
,
"495362301276927"
,
"1e25c95ba8cc4f4fc91ca12d213e32bb"
,
callback_url:
"http://localhost:3000/users/auth/facebook/callback"
config
.
omniauth
:facebook
,
"2429624190692901"
,
"03da24c1517b0bfa4acc70852f61fb60"
,
token_params:
{
parse: :json
}
callback_url:
"http://localhost:3000/users/auth/facebook/callback"
# config.omniauth :facebook, "APP_ID", "APP_SECRET", token_params: { parse: :json }
end
config/routes.rb
View file @
3723122c
Rails
.
application
.
routes
.
draw
do
resources
:templates
devise_for
:users
,
:controllers
=>
{
:omniauth_callbacks
=>
"omniauth_callbacks"
}
devise_for
:users
,
:controllers
=>
{
:omniauth_callbacks
=>
"
users/
omniauth_callbacks"
}
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
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