Simple-Auth:开始时遇到麻烦

时间:2014-08-07 21:03:34

标签: ember.js ember-simple-auth

我无法关注SimpLabs' starting guide for ember-simple-auth

按照主页上的指南,逐字逐句,不起作用。

当我测试我的登录表单时,“authenticate”操作会转到控制器和错误。


堆栈:

TypeError: Cannot read property 'authenticate' of undefined
    at http://local-03-02-xx.lariatcentral.net/assets/vendor.js:61403:48
    at invokeResolver (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:23342:9)
    at new Promise (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:23328:9)
    at __exports__.default.Ember.ObjectProxy.extend.authenticate (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:61402:16)
    at __exports__.default.Ember.Mixin.create.actions.authenticate (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:61176:62)
    at apply (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:21143:27)
    at superFunction [as _super] (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:17841:15)
    at __exports__.default.Ember.Mixin.create.actions.authenticate (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:61234:23)
    at apply (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:21141:32)
    at superWrapper (http://local-03-02-xx.lariatcentral.net/assets/vendor.js:20721:15) 

代码

应用程序/路由/ application.js中

import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';

export default Ember.Route.extend(ApplicationRouteMixin);

应用程序/控制器/ login.js

import Ember from 'ember';
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';

export default Ember.Controller.extend(LoginControllerMixin, {
    authenticator: 'authenticator:custom'
});

应用程序/模板/ login.hbs

<form {{action authenticate on='submit'}}>
    <div>
        <label for="identification">
            <span class="sr-only">Login:</span>
            <div class="input-group">
                <span class="input-group-addon"><span class=" glyphicon glyphicon-user"></span></span>
                {{input type="text" value=identification id="identification" class="form-control" placeholder="Login"}}
             </div>
         </label>
     </div>
     <div>
         <label for="password">
             <span class="sr-only">Password:</span>
             <div class="input-group">
                 <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                 {{input type="password" value=password id="password" class="form-control" placeholder="Password"}}
             </div>
         </label>
     </div>
     <button type="submit" class="btn btn-block action-sm">Login</button>
 </form>

网站忘记提及了一个额外的步骤吗?我觉得我已经检查并重新检查了一切......

0 个答案:

没有答案