Skip to content

Commit

Permalink
Merge pull request #17 from tmeasday/0.6.5
Browse files Browse the repository at this point in the history
Works with 0.6.5
  • Loading branch information
erobit committed Aug 19, 2013
2 parents e12b128 + 25a3dfc commit d76414b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.build*
34 changes: 7 additions & 27 deletions login_buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,46 +112,26 @@ Accounts._loginButtons.displayName = function () {
// login_buttons_dropdown.html
Accounts._loginButtons.getLoginServices = function () {
var self = this;
var services = [];

// find all methods of the form: `Meteor.loginWithFoo`, where
// `Foo` corresponds to a login service
//
// XXX we should consider having a client-side
// Accounts.oauth.registerService function which records the
// active services and encapsulates boilerplate code now found in
// files such as facebook_client.js. This would have the added
// benefit of allow us to unify facebook_{client,common,server}.js
// into one file, which would encourage people to build more login
// services packages.
_.each(_.keys(Meteor), function(methodName) {
var match;
if ((match = methodName.match(/^loginWith(.*)/))) {
var serviceName = match[1].toLowerCase();

// HACKETY HACK. needed to not match
// Meteor.loginWithToken. See XXX above.
if (Accounts[serviceName])
services.push(match[1].toLowerCase());
}
});

// First look for OAuth services.
var services = Package['accounts-oauth'] ? Accounts.oauth.serviceNames() : [];

// Be equally kind to all login services. This also preserves
// backwards-compatibility. (But maybe order should be
// configurable?)
services.sort();

// ensure password is last
if (_.contains(services, 'password'))
services = _.without(services, 'password').concat(['password']);
// Add password, if it's there; it must come last.
if (Accounts._loginButtons.hasPasswordService())
services.push('password');

return _.map(services, function(name) {
return {name: name};
});
};

Accounts._loginButtons.hasPasswordService = function () {
return Accounts.password;
return !!Package['accounts-password'];
};

Accounts._loginButtons.dropdown = function () {
Expand Down
13 changes: 12 additions & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@ Package.describe({
});

Package.on_use(function (api) {
api.use(['accounts-urls', 'accounts-base', 'underscore', 'templating', 'bootstrap', 'jquery'], 'client');
api.use(['accounts-base', 'underscore', 'templating', 'bootstrap', 'jquery', 'handlebars'], 'client');

// Export Accounts (etc) to packages using this one.
api.imply('accounts-base', ['client', 'server']);

// Allow us to call Accounts.oauth.serviceNames, if there are any OAuth
// services.
api.use('accounts-oauth', {weak: true});
// Allow us to directly test if accounts-password (which doesn't use
// Accounts.oauth.registerService) exists.
api.use('accounts-password', {weak: true});


api.add_files([
'accounts_ui.js',
Expand Down

0 comments on commit d76414b

Please sign in to comment.