Comments (11)
This is also happening to me too using the latest canary build. I'm not sure whats causing it!
According to the documentation send() should bubble up the tree, therefore reaching the ApplicationRoute and triggering the login action. But for some reason it isn't working.
I've tried changing the order of my code so that the ApplicationRoute is created early on in the code, incase it wasn't initialised quick enough but this doesn't seem to make any difference for me :(
from ember-simple-auth.
I think this is a similar problem as the one described here: https://gist.github.com/machty/6879857 (see point 4 in the list) - not sure how to fix it yet...
from ember-simple-auth.
Changing triggerLogin
in Ember.SimpleAuth.AuthenticatedRouteMixin
from this:
triggerLogin: function(transition) {
this.set('session.attemptedTransition', transition);
this.send('login');
}
to this:
triggerLogin: function(transition) {
this.set('session.attemptedTransition', transition);
App.__container__.lookup('route:application')._actions['login'].apply(this);
}
actually does fix it but of course isn't desirable. Problem really seems to be that there's no active view hierarchy after a fresh reload that the action could be triggered on. Maybe somehow it can be triggered on the transition or so...
from ember-simple-auth.
Ok, got it - solution is here: machty/ember.js@160a41c -call #send on the transition rather than on this:
triggerLogin: function(transition) {
this.set('session.attemptedTransition', transition);
transition.send('login');
}
Transition#send
is only available with Ember.js 1.2 though. Not sure how I want to handle that - probably ok to require Ember.js 1.2 I guess... What do you guys think?
from ember-simple-auth.
Thank you for fixing it so fast, Marco.
I think it is ok to require Ember 1.2 or higher. I would even say that it is required (not just recommended) since that is quite a serious bug, in my opinion.
from ember-simple-auth.
What I'm doing is this now:
if (Ember.canInvoke(transition, 'send')) {
transition.send('login');
} else {
this.send('login');
}
That means the bug is fixed for 1.2 without completely breaking functionality for < 1.2. I think I'd remove that again some time after 1.2 is officially released...
from ember-simple-auth.
Looks good. Thank you for this library!
from ember-simple-auth.
Hi (and happy new year !), I still have the initial problem mentioned by balinterdi. I run my app with ember 1.2.
Why don't you simply use ?
this.transitionTo(Ember.SimpleAuth.loginRoute);
This works for me but I would prefer keep your code ;-)
from ember-simple-auth.
Can you add a stack trace? Would be strange if you really saw the same error as above with 1.2.
from ember-simple-auth.
Sincerely sorry for this mistake in my first post :( . I've changed my bower.json file to upgrade in 1.2 but, you know, it's not enough... So, It works perfectly now. Thanks a lot for your help and also for your component.
from ember-simple-auth.
Hi, everyone. I have the same issue, as described here, but without any errors in my console. I use Ember 1.13.3.
UPD. Problem is in my code: my login route is nested to 'lang' route:
Router.map(function () {
this.route("lang", { path: '/:lang' }, function () {
this.route('404', { path: '/*:' });
this.route('login', { path: '/login' });
this.route('countries', {path: '/countries'}, function() {
this.route('country', {path: '/:id'});
});
});
});
Protected routes are lang.countries and lang.countries.country.
UPD2. I changed sessionRequiresAuthentication action in application-route-mixin and this helped me to solve this issue:
sessionRequiresAuthentication: function () {
var attemptedTransition = this.get(Configuration.sessionPropertyName).get('attemptedTransition');
var params;
if (attemptedTransition && attemptedTransition.params) {
var authRouteParts = Configuration.authenticationRoute.split('.');
var route = '';
for (var i = 0; i < authRouteParts.length; i++) {
if (route !== '') {
route += '.';
}
route += authRouteParts[i];
if (attemptedTransition.params[route] !== undefined) {
for (var k in attemptedTransition.params[route]) {
if (attemptedTransition.params[route].hasOwnProperty(k)) {
if (params === undefined) {
params = {};
}
params[k] = attemptedTransition.params[route][k];
}
}
}
}
}
if (params !== undefined) {
this.transitionTo(Configuration.authenticationRoute, params);
} else {
this.transitionTo(Configuration.authenticationRoute);
}
}
from ember-simple-auth.
Related Issues (20)
- Deprecation: `old-deprecate-method-paths` HOT 1
- Ember Simple Auth: The automatic session initialization is deprecated on Ember 3.28.4 HOT 9
- Is Torii addon abandonned ? HOT 9
- Ember 4.1.0: Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead. HOT 1
- Unhandled Promise error detected when using the manual session.setup function HOT 9
- When I logout of one tab the authenticated data still seems to be populated in another tab HOT 1
- React to authentication in a component via modifier HOT 2
- v2 addon format HOT 5
- Typescript error on accessing prohibitAuthentication HOT 3
- CookieStore is not initializing/syncing correctly HOT 2
- Dependency Dashboard
- CookieExpirationTime not being set HOT 2
- When syncing tabs (session store), schedule of the refresh token should be updated
- ember-polyfills.deprecate-assign deprication in Ember 4.4 HOT 2
- Action Required: Fix Renovate Configuration
- ESA's Application route hides host app's route when using pod layout & embroider HOT 5
- Access token does not persist HOT 1
- Neither of test apps work - did you stop maintaining it? HOT 1
- Missing deprecation guide for session events HOT 1
- test-app should use modern Octane syntax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-simple-auth.