ember-cli-simple-auth-firebase
Advanced tools
Comparing version 1.0.5 to 1.1.0
@@ -1,5 +0,7 @@ | ||
import Base from 'simple-auth/authenticators/base'; | ||
import Base from 'ember-simple-auth/authenticators/base'; | ||
import Firebase from 'firebase'; | ||
import config from '../config/environment'; | ||
const { Promise } = Ember.RSVP; | ||
export default Base.extend({ | ||
@@ -43,21 +45,36 @@ | ||
authenticate: function(options) { | ||
var _this = this; | ||
var _this = this; | ||
if(options.provider === "password" || !options.provider){ | ||
return new Promise(function(resolve, reject) { | ||
_this.get('firebase').authWithPassword({ | ||
'email': options.email, | ||
'password': options.password | ||
}, function(error, authData) { | ||
Ember.run(function() { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(authData); | ||
} | ||
}); | ||
_this.get('firebase').authWithPassword({ | ||
'email': options.email, | ||
'password': options.password | ||
}, function(error, authData) { | ||
Ember.run(function() { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(authData); | ||
} | ||
}); | ||
}); | ||
}); | ||
} else { | ||
return new Promise(function(resolve, reject) { | ||
var callback = function(error, authData) { | ||
Ember.run(function() { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(authData); | ||
} | ||
}); | ||
}; | ||
if(options.redirect){ | ||
_this.get('firebase').authWithOAuthRedirect(options.provider, callback); | ||
} else { | ||
_this.get('firebase').authWithOAuthPopup(options.provider, callback) | ||
} | ||
}); | ||
} | ||
}, | ||
@@ -73,2 +90,2 @@ invalidate: function(data) { | ||
} | ||
}); | ||
}); |
@@ -5,6 +5,6 @@ import FirebaseAuthenticator from '../authenticators/firebase'; | ||
name: 'firebase-auth', | ||
before: 'simple-auth', | ||
before: 'ember-simple-auth', | ||
initialize: function(container, app) { | ||
container.register('authenticator:firebase', FirebaseAuthenticator); | ||
} | ||
} | ||
} |
{ | ||
"name": "ember-cli-simple-auth-firebase", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "Firebase Authenticator for Ember Simple Auth", | ||
@@ -5,0 +5,0 @@ "directories": { |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
8573
8
89
1
55