Currently, my Ember-cli application logs out after refresh. I have altered my code a lot to try to get it to work, but none helped. If necessary, I will try to implement authentication with another provider.
I have a route for application, which is just the logout and a route for login, which deals with login, because the client wants to style it.
My config/environment.js file looks like this:
firebase: 'http://ift.tt/1SXgd6J',
torii: {
sessionServiceName: 'session'
},
app/adapters/application.js:
import Ember from 'ember';
import FirebaseAdapter from 'emberfire/adapters/firebase';
const { inject } = Ember;
export default FirebaseAdapter.extend({
firebase: inject.service(),
});
app/torii-adapters/application.js:
import Ember from 'ember';
import ToriiFirebaseAdapter from 'emberfire/torii-adapters/firebase';
export default ToriiFirebaseAdapter.extend({
firebase: Ember.inject.service()
});
app/routes/application.js:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
logout: function() {
this.get('session').close().then(function() {
this.transitionTo('application');
}.bind(this));
}
}
});
app/routes/login.js:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
login: function() {
var controller = this.get('controller');
var email = controller.get('userEmail');
var password = controller.get('userPassword');
this.get('session').open('firebase', {
provider: 'password',
email: email,
password: password
}).then(function() {
this.transitionTo('dashboard');
}.bind(this));
}
}
});
Yeah, currently, login and logout works just fine, but I cannot refresh the page in the middle of the session, or else it logs out me automatically.
Thanks to anyone in advance.
Aucun commentaire:
Enregistrer un commentaire