diff --git a/.meteor/packages b/.meteor/packages index db5c4d6..576ae48 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -14,4 +14,5 @@ accounts-password mrt:moment reactive-var kevohagan:sweetalert +accounts-twitter diff --git a/.meteor/versions b/.meteor/versions index d5386f7..bf41967 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,5 +1,7 @@ accounts-base@1.1.1 +accounts-oauth@1.1.1 accounts-password@1.0.2 +accounts-twitter@1.0.1 application-configuration@1.0.2 autoupdate@1.1.1 base64@1.0.0 @@ -44,6 +46,8 @@ mongo@1.0.6 mrt:moment@2.8.1 natestrauser:font-awesome@4.2.0 npm-bcrypt@0.7.7 +oauth1@1.1.0 +oauth@1.1.0 observe-sequence@1.0.2 ordered-dict@1.0.0 perak:markdown@1.0.4 @@ -61,6 +65,7 @@ spacebars@1.0.2 srp@1.0.0 templating@1.0.7 tracker@1.0.2 +twitter@1.1.0 ui@1.0.3 underscore@1.0.0 url@1.0.0 diff --git a/README.md b/README.md index 3250819..1b77afa 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,22 @@ If you want to set up a server, make sure to configure the `MAIL_URL` and `ROOT_URL` environment variables as explained in the [Meteor Docs](http://docs.meteor.com). +#### Twitter Authentication + +Create this file: `server/settings.coffee` with this content: + +```coffeescript +Meteor.startup -> + Accounts.loginServiceConfiguration.remove service : 'twitter' + Accounts.loginServiceConfiguration.insert + service: 'twitter' + consumerKey: 'Your API key' + secret: 'Your API secret' +``` + +Your users will now be able to login using twitter. You may want to disable the +button if you don't configure twitter authentication. + ## License The MIT License (MIT) diff --git a/client/client.coffee b/client/client.coffee index f967bdf..887b324 100644 --- a/client/client.coffee +++ b/client/client.coffee @@ -2,9 +2,11 @@ docs = new Meteor.Collection 'docs' amIValid = -> return no unless Meteor.user() + return yes if !Meteor.user().emails? return yes for mail in Meteor.user().emails when mail.verified is yes; no -UI.registerHelper 'mail', -> Meteor.user().emails[0].address +UI.registerHelper 'mail', -> + if Meter.user().emails then Meteor.user().emails[0].address UI.registerHelper 'amIValid', amIValid Router.configure @@ -17,7 +19,6 @@ docController = RouteController.extend waitOn: -> Meteor.subscribe 'doc', @params._id data: -> docs.findOne @params._id action: -> - console.log @render if @ready() if @data()? then @render() else @render '404' @@ -85,14 +86,20 @@ share.notify = notify = (opt) -> errCallback = (err) -> return unless err - console.log err if err.reason notify title: err.code or 'Error', msg: err.reason, type: 'error' else notify title: 'Error', msg: err, type: 'error' Template.layout.notHome = -> Router.current().route.name isnt 'home' -Template.layout.showSpinner = -> - Meteor.status().connected is no or Router.current().ready() is no +Template.layout.showSpinner = -> Meteor.status().connected is yes +Template.home.events + 'click #twitter-login': -> + if Meteor.user() then return notify msg: "You're already Logged In!" + Meteor.loginWithTwitter {}, (e) -> + if e then errCallback e + else + Meteor.subscribe 'user' + notify type: 'success', msg: 'Logged in' Template.editor.isPublic = -> return "checked" if @public is yes Template.editor.showTitleChecked = -> return "checked" unless @showTitle is no Template.editor.events diff --git a/client/style.less b/client/style.less index 5a716c9..789bcf3 100644 --- a/client/style.less +++ b/client/style.less @@ -74,6 +74,9 @@ #profile-tools { margin-top: 1em; margin-bottom: 1em; + a { + margin-bottom: 1em; + } } .label { diff --git a/client/templates.html b/client/templates.html index 2fe55df..314e0ce 100644 --- a/client/templates.html +++ b/client/templates.html @@ -50,9 +50,7 @@ {{#markdown}} ### Share your markdown easily -Markcloud is a simple application that lets you share your markdown documents -to the world. Just paste your markdown and get a _permanent link_ that lets you -and everyone else view the result in a **modern responsive web page**. +Markcloud is a simple application that lets you share your markdown documents to the world. Just paste your markdown and get a _permanent link_ that lets you and everyone else view the result in a **modern responsive web page**. ### Free as in Free Software @@ -77,10 +75,14 @@ This home page is written in markdown too! You will be able to delete your account and all your data whenever you want. {{/markdown}}
+ + Log In With Twitter +
or
Sign Up Log In +
@@ -187,7 +189,11 @@ You will be able to delete your account and all your data whenever you want.