Merge pull request #7 from fedwiki/paul90/i6

a fix for issue 6
This commit is contained in:
Ward Cunningham
2016-11-21 21:08:48 -08:00
committed by GitHub
3 changed files with 17 additions and 5 deletions

View File

@ -105,6 +105,18 @@ update_footer = (ownerName, isAuthenticated) ->
if response.ok if response.ok
console.log 'Alternative Identity added', response console.log 'Alternative Identity added', response
settings.usingPersona = false settings.usingPersona = false
if settings.wikiHost
dialogHost = settings.wikiHost
else
dialogHost = window.location.hostname
settings.cookieDomain = dialogHost
if settings.useHttps
dialogProtocol = 'https:'
else
dialogProtocol = window.location.protocol
if window.location.port
dialogHost = dialogHost + ':' + window.location.port
settings.dialogURL = dialogProtocol + '//' + dialogHost + '/auth/loginDialog'
update_footer ownerName, isAuthenticated update_footer ownerName, isAuthenticated
else else
console.log 'Attempt to claim site failed', response console.log 'Attempt to claim site failed', response

View File

@ -7,7 +7,7 @@
* Login to [Twitter Application Management](https://apps.twitter.com/). * Login to [Twitter Application Management](https://apps.twitter.com/).
* Create a new Twitter App, by clicking on **Create New App**. * Create a new Twitter App, by clicking on **Create New App**.
![Twitter Create New App](./images/twitter-new-app.png) ![Twitter Create New App](./images/twitter-new-app.png)
* Provide your application details. You can either leave the **Callback URL** blank, or if you are only protecting a single wiki domain enter `https://example.wiki/auth/twitter/callback`. * Provide your application details. The **Callback URL** should be set with a place holder, for example `https://example.wiki/auth/twitter/callback`.
![Twitter App Details](./images/twitter-app-details.png) ![Twitter App Details](./images/twitter-app-details.png)
* Agree to the *Developer Agreement* and click **Create your Twitter application**. * Agree to the *Developer Agreement* and click **Create your Twitter application**.
* Once the app has been created, go to the **Settings** tab and check that the **Allow this application to be used to Sign in with Twitter** option is selected. * Once the app has been created, go to the **Settings** tab and check that the **Allow this application to be used to Sign in with Twitter** option is selected.

View File

@ -448,7 +448,7 @@ module.exports = exports = (log, loga, argv) ->
user = req.session.passport.user user = req.session.passport.user
idProviders = _.keys(user) idProviders = _.keys(user)
ids = {} userIds = {}
idProviders.forEach (idProvider) -> idProviders.forEach (idProvider) ->
id = switch idProvider id = switch idProvider
when "twitter" then { when "twitter" then {
@ -486,7 +486,7 @@ module.exports = exports = (log, loga, argv) ->
email: user.persona.email email: user.persona.email
} }
} }
ids = _.merge(ids, id) userIds = _.merge(userIds, id)
wikiDir = path.resolve(argv.data, '..') wikiDir = path.resolve(argv.data, '..')
statusDir = argv.status.split(path.sep).slice(-1)[0] statusDir = argv.status.split(path.sep).slice(-1)[0]
@ -505,7 +505,7 @@ module.exports = exports = (log, loga, argv) ->
if _.intersectionWith(_.entries(siteOwner), _.entries(user), _.isEqual).length > 0 if _.intersectionWith(_.entries(siteOwner), _.entries(user), _.isEqual).length > 0
updateOwner = _.merge(user, siteOwner) updateOwner = _.merge(user, siteOwner)
fs.writeFile(path.join(wikiDir, file), JSON.stringify(ids), (err) -> fs.writeFile(path.join(wikiDir, file), JSON.stringify(userIds), (err) ->
if err if err
console.log 'Error writing ', file, err console.log 'Error writing ', file, err
# if the write works the change will be picked up by fs.watch() in watchForOwnerChange # if the write works the change will be picked up by fs.watch() in watchForOwnerChange