Je suis en train de mettre en place un système d'authentification de Braise avec les versions suivantes:authentification à l'aide Ember-auth-simple, concevoir et rails backend
DEBUG: -------------------------------
ember.debug.js:5378 DEBUG: Ember : 1.13.7
ember.debug.js:5378 DEBUG: Ember Data : 1.13.8
ember.debug.js:5378 DEBUG: jQuery : 1.11.3
ember.debug.js:5378 DEBUG: Ember Simple Auth : 0.8.0
ember.debug.js:5378 DEBUG: Ember Simple Auth Devise : 0.8.0
ember.debug.js:5378 DEBUG: -------------------------------
J'ai suivi les instructions sur GitHub pour https://github.com/simplabs/ember-simple-auth/tree/master/packages/ember-simple-auth-devise
maintenant quand je frappe « sign up », il renvoie une erreur 500:
POST http://localhost:4200/users/sign_in 500 (Internal Server Error)
Je me sens comme il devrait aller à localhost: 3000/utilisateurs/sign_in, mais ce n'est pas.
J'ai lancé le serveur avec la commande ember s --proxy http://localhost:3000
, mais je ne comprends pas ce qui se passe.
Voici mon code de référence:
contrôleur/login.js
import Ember from 'ember';
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';
export default Ember.Controller.extend(LoginControllerMixin, {
authenticator: 'simple-auth-authenticator:devise'
});
routes/login.js
import Ember from 'ember';
import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';
export default Ember.Route.extend(UnauthenticatedRouteMixin);
templates/application.hbs
<h2 id="title">Welcome to Ember.js - With Authentication!</h2>
{{#if session.isAuthenticated}}
Hi, {{session.email}}
<br/>
You can't see this text unless you're logged in!
<br/>
Click this button to logout:
<button {{action 'invalidateSession'}}>Logout</button>
<br/>
If you try to go to the
{{#link-to "login"}}Login{{/link-to}}
page, you should get redirected!
{{else}}
{{#link-to "login"}}Login{{/link-to}}
{{/if}}
{{outlet}}
templates/login.hbs
<form {{action "authenticate" on="submit"}}>
<div>
<label for="identification">E-mail</label><br />
{{input value=identification placeholder="E-mail" type="text" name="email"}}
</div>
<div>
<label for="password">Password</label><br />
{{input value=password placeholder="Password" type="password" name="password"}}
</div>
<div>
<button type="submit">Log in</button>
</div>
</form>
config/environment.js
...
ENV['simple-auth'] = {
authorizer: 'simple-auth-authorizer:devise'
}
ENV['simple-auth-devise'] = {
tokenAttributeName: 'token',
identificationAttributeName: 'email'
}
...
routes Mes rails ressemble:
devise_for :users, controllers: { sessions: 'sessions' }
La demande atteint-elle toujours le backend Rails? – marcoow
oui, ça retourne, 'ActionController :: RoutingError (Aucune route ne correspond à [POST]"/users/sign_in "):' (j'ai ajouté mes routes de conception ci-dessus) –
Cela signifie que la route '/ users/sign_in' n'est pas configurée dans l'application Rails, cette erreur 500 – marcoow