the-refinery / ember-devise-simple-auth Goto Github PK
View Code? Open in Web Editor NEWA plugin to integrate your Ember app with a (mostly stock) Devise setup
License: MIT License
A plugin to integrate your Ember app with a (mostly stock) Devise setup
License: MIT License
What is the recommended way to handle client side validation for login? I added ember-validations to the session model, but it seems to POST to the login URL no matter what.
For those using ember-data, allow specifying userTypeKey
in the configuration. Load currentSession
as that model through the store.
Currently the app
namespace is configurable in eak. I'm going to recommend following the eak-rails convention there so this will be easier to support.
Go to sign in, submit credentials, isSignedIn
is true but currentUser
is undefined. Now go to another route that makes a request, currentUser
is set. Saw this behavior in latest Chrome in an Ember Rails app.
Currently there is a request every time we change routes, what about not doing it if we already have a currentSession?
Is there a reason for making always this request? Maybe we could handle at a higher level 401, and then try to get the /session/current
/redirect to sign-in.
The following blows up when running with phantomjs this.setupSession.bind
since bind is not implemented.
Clicking around a site with this plugin implemented, it seems to be doing multiple /sessions/current
checks on every transition. Need to calm that down a bit.
I'm trying the method that @abuiles uses in Fractura, to sign up a user through Devise, but even though I have everything regarding sign-up matching his. I'm still getting these transitions when I navigate to /#sign-up
:
Transition #0: TRANSITION COMPLETE. ember.js?body=1:15374
Ember Inspector Active VM4204:161
Attempting transition to signUp ember.js?body=1:15374
Attempting transition to session ember.js?body=1:15374
Transition #1: signUp: transition was aborted ember.js?body=1:15374
Transition #2: session: calling beforeModel hook ember.js?body=1:15374
Transition #1: detected abort. ember.js?body=1:15374
Transition #2: session: calling deserialize hook ember.js?body=1:15374
Transition #2: session: calling afterModel hook ember.js?body=1:15374
Transition #2: Resolved all models on destination route; finalizing transition. ember.js?body=1:15374
Transitioned into 'session' ember.js?body=1:15374
Transition #2: TRANSITION COMPLETE.
I made sure that the route for sign-up contains skipsAuthentication: true
, but it seems that some hook in devise is making it go back to the sign-in template. I'm fairly new to Devise with Ember so I'm sure I'm missing something, I just don't really know where to start looking. Any ideas?
When i try to sign in, the session controller searches for a user by id. This is from console:
Started POST "/users/sign_in" for 127.0.0.1 at 2014-04-11 13:25:04 +0200
Processing by EmberDeviseSimpleAuth::SessionsController#create as JSON
Parameters: {"user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]"}}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
Completed 201 Created in 6ms (Views: 1.2ms | ActiveRecord: 0.4ms)
Is this right? Im using EAKR and have the same setup as the facturas sample app
I am able to get into a state where my login page no longer works and is posting null for user[email]
and user[password]
to /users/sign_in
even though I am providing those in the session template on submit.
In some cases it may be necessary to extend SessionRoute
. Add it to Ember.DeviseSimpleAuth
for those cases.
A session can have more that just an user, since this is just an user object It would be better to have this called currentUser
which makes clearer that it is an user object.
Sounds like es6-module-transpiler
will be losing support for globals. The new recommendation is to wrap AMD modules with a loader. We'll add a file that creates the global objects on Ember.DeviseSimpleAuth
. The only problem is going to be SessionsRoute
. Since we won't know the name of the Ember.Application
global at require time. Options are:
route:session
on the containerDoes anyone have a preference?
Loading the user model is done for convenience, therefore it shouldn't error out if it doesn't exist.
I keep getting Could not find generator ember_devise_simple_auth:install.
In the readme it says to configure this way:
window.App = require('app').default.create({
deviseEmberAuth: {
// ...
}
});
However, in the index.js file the get setting key uses the deviseSimpleAuth
prefix:
var getSetting = function(app, setting) {
var prefixedKey = "deviseSimpleAuth." + setting;
return app.getWithDefault(prefixedKey, defaults[setting]);
};
One or the other should be updated but I'm not sure which. Thanks!
I use gem 'ember-devise-simple-auth' and 'ember-rails', I got the couldn't find file 'ember-devise-simple-auth/globals'
error.
And I try to use the example https://github.com/d-i/ember-devise-simple-auth/tree/master/examples/ember-rails also have this problem. I think something wrong with my operation or the gem bug?
Hello,
I've installed simple-auth via bower and gem for client and server-side. I've also created the session template with a form with a call to the signIn action. However when I click on it I get a 401 unauthorized response for /sessions/current
.
GET "sessions/current" processing by EmberDeviseSimpleAuth::SessionsController#show as JSON completed unauthorized in 1ms
I am using ember-rails 0.15, Rails 4 and Devise
Do you think it could be a Simple-Auth thing or is it maybe more Devise related?
Thanks in advance
After loading gem, bundling, running the generator, and setting up my application.js, I get the following Sprockets error:
Sprockets::FileNotFound at /
couldn't find file 'ember-devise-simple-auth/appkit'
(in /Users/[...]/config/application.js:5)
Here's my config/application.js
//= require jquery
//= require environment
//= require ember-appkit
//= require router
//= require ember-devise-simple-auth/appkit
//= require_self
//= require_tree ./adapters
//= require_tree ../app
//= require_tree ./initializers
require('ember-devise-simple-auth');
window.App = require('app').default.create({
deviseEmberAuth: {
signInPath: "/sign-in",
deviseSignInPath: "/users/sign_in",
deviseSignOutPath: "/users/sign_out",
currentSessionPath: "/sessions/current"
}
});
Broccoli is awesome for a build tool, but I'd like to replace build.sh
with a proper grunt workflow that can handle releasing too.
I have almost everything set up and working fine - thanks for a great gem! However I am trying to redirect after signin. I added the below to application.js
, from the docs:
export default Ember.Route.extend({
actions: {
validSignIn: function() {
this.transitionTo("compose");
}
}
});
I tried that but I just get Uncaught SyntaxError: Unexpected reserved word
I've googled around, and I guess I'm missing some dependency, but to be honest most of what I read about export module
was beyond me.
I tried adding the same action to application.js
without the export default
part and the redirect still doesn't work:
Ember.Route.extend({
actions: {
validSignIn: function() {
this.transitionTo("compose");
}
}
});
Am I missing something obvious?! Any help appreciated.
It depends on 'dist/bower.json' but it's not found.
There was a Errno::ENOENT while loading ember_devise_simple_auth.gemspec:
No such file or directory - /Users/adolfo/.rvm/gems/ruby-2.0.0-p0@facturas/bundler/gems/ember-devise-simple-auth-7f420775a30e/dist/bower.json from
/Users/adolfo/.rvm/gems/ruby-2.0.0-p0@facturas/bundler/gems/ember-devise-simple-auth-7f420775a30e/ember_devise_simple_auth.gemspec:4:in `<main>'
The old version as of (March 11th/13th) works fine for me, but when upgrading to the newest version that deserializes the /sessions/current user information into ember data, it breaks the front-end functionality for me. The old version uses: currentSession, the new version uses: currentUser.
I am using ember-rails.
After some testing, I discovered the problem seems to be the new javascript code. The GEM upgrade still lets me access the /sessions/current information via rails (and still works when I leave the old index.js version in place), but when I try to replace the index.js file with the new version, it constantly redirects me to sign-in no matter what I do.
I tried both with and without a user model created in Ember.
Any help would be appreciated!
All the best,
Jason
Should not try to load session if skipsAuthentication is true but isSignedIn is false.
I found this problem, When my route get the data from server and counld not use currentUser
in the template. Like this:
App.OrdersRoute = Em.Route.extend
model: ->
App.Order.findAll()
And In my orders.hbs
and the currentUser
is null.
But if I remove the model like this:
App.OrdersRoute = Em.Route.extend()
It will can find currentUser
. Is it something wrong with my code?or the other?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.