Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
c03dae93
Commit
c03dae93
authored
Apr 28, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: facebook auth module
parent
2abecea0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
15 deletions
+32
-15
admin-auth.vue
client/components/admin/admin-auth.vue
+9
-3
authentication.js
server/modules/authentication/facebook/authentication.js
+16
-7
definition.yml
server/modules/authentication/facebook/definition.yml
+7
-5
No files found.
client/components/admin/admin-auth.vue
View file @
c03dae93
...
...
@@ -23,7 +23,8 @@
v-list-tile(:key='str.key', @click='selectedStrategy = str.key', :disabled='!str.isAvailable')
v-list-tile-avatar
v-icon(color='grey', v-if='!str.isAvailable') indeterminate_check_box
v-icon(color='primary', v-else-if='str.isEnabled', v-ripple, @click='str.key !== `local` && (str.isEnabled = false)') check_box
v-icon(color='primary', v-else-if='str.isEnabled && str.key !== `local`', v-ripple, @click='str.isEnabled = false') check_box
v-icon(color='primary', v-else-if='str.isEnabled && str.key === `local`') check_box
v-icon(color='grey', v-else, v-ripple, @click='str.isEnabled = true') check_box_outline_blank
v-list-tile-content
v-list-tile-title.body-2(:class='!str.isAvailable ? `grey--text` : (selectedStrategy === str.key ? `primary--text` : ``)')
{{
str
.
title
}}
...
...
@@ -72,8 +73,13 @@
img(:src='strategy.logo', :alt='strategy.title')
.caption.pt-3
{{
strategy
.
description
}}
.caption.pb-3: a(:href='strategy.website')
{{
strategy
.
website
}}
.body-2(v-if='strategy.isEnabled') This strategy is #[v-chip(color='green', small, dark, label) active]
.body-2(v-else) This strategy is #[v-chip(color='red', small, dark, label) not active]
.body-2(v-if='strategy.isEnabled')
span This strategy is
v-chip(color='green', small, dark, label) active
span(v-if='selectedStrategy === `local`') and cannot be disabled.
.body-2(v-else)
span This strategy is
v-chip(color='red', small, dark, label) not active
v-divider.mt-3
v-subheader.pl-0 Strategy Configuration
.body-1.ml-3(v-if='!strategy.config || strategy.config.length < 1'): em This strategy has no configuration options you can modify.
...
...
server/modules/authentication/facebook/authentication.js
View file @
c03dae93
...
...
@@ -5,6 +5,7 @@
// ------------------------------------
const
FacebookStrategy
=
require
(
'passport-facebook'
).
Strategy
const
_
=
require
(
'lodash'
)
module
.
exports
=
{
init
(
passport
,
conf
)
{
...
...
@@ -13,13 +14,21 @@ module.exports = {
clientID
:
conf
.
clientId
,
clientSecret
:
conf
.
clientSecret
,
callbackURL
:
conf
.
callbackURL
,
profileFields
:
[
'id'
,
'displayName'
,
'email'
]
},
function
(
accessToken
,
refreshToken
,
profile
,
cb
)
{
WIKI
.
models
.
users
.
processProfile
(
profile
).
then
((
user
)
=>
{
return
cb
(
null
,
user
)
||
true
}).
catch
((
err
)
=>
{
return
cb
(
err
,
null
)
||
true
})
profileFields
:
[
'id'
,
'displayName'
,
'email'
,
'photos'
],
authType
:
'reauthenticate'
},
async
(
accessToken
,
refreshToken
,
profile
,
cb
)
=>
{
try
{
const
user
=
await
WIKI
.
models
.
users
.
processProfile
({
profile
:
{
...
profile
,
picture
:
_
.
get
(
profile
,
'photos[0].value'
,
''
)
},
providerKey
:
'facebook'
})
cb
(
null
,
user
)
}
catch
(
err
)
{
cb
(
err
,
null
)
}
}
))
}
...
...
server/modules/authentication/facebook/definition.yml
View file @
c03dae93
...
...
@@ -5,16 +5,18 @@ author: requarks.io
logo
:
https://static.requarks.io/logo/facebook.svg
color
:
indigo
website
:
https://facebook.com/
isAvailable
:
fals
e
isAvailable
:
tru
e
useForm
:
false
scopes
:
-
email
props
:
clientId
:
type
:
String
title
:
Client
ID
hint
:
Application
Client
ID
title
:
App
ID
hint
:
Application ID
order
:
1
clientSecret
:
type
:
String
title
:
Client
Secret
hint
:
Application
Client
Secret
title
:
App
Secret
hint
:
Application Secret
order
:
2
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