2014-10-14 2 views
0

ember-simple-auth의 기본 구성을 사용하고 있습니다. 제출을 클릭하면 요청이 백엔드로 전송되었지만 비밀번호 필드는 비어있게됩니다. 내 사용자 이름 입력란이 아직 채워져 있습니다. 로그인 양식을 제출할 때 비밀번호를 지우지 않으려면 어떻게해야합니까?

내 템플릿 : login.emblem

form.submit='authenticate' 
    Ember.TextField id='identification' valueBinding='identification' 
    Ember.TextField id='password' type='password' valueBinding='password' 

    button type='submit' 
    | Login 

컨트롤러 : 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:oauth2-password-grant", 
}); 

경로 : 대신 간단하게 정의 할 수 있습니다 LoginControllerMixin's authenticate action를 사용하는

import Ember from "ember"; 
import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin'; 
export default Ember.Route.extend(UnauthenticatedRouteMixin, { 
}); 

답변

1

을 login.js 당신의 소유 :

import Ember from 'ember'; 
import AuthenticationControllerMixin from 'simple-auth/Authentication-controller-mixin'; 

export default Ember.Controller.extend(AuthenticationControllerMixin, { 
    authenticator: 'simple-auth-authenticator:oauth2-password-grant', 
    actions: { 
    authenticate: function() { 
     var data = this.getProperties('identification', 'password'); 
     return this._super(data); 
    } 
    } 
}); 
+0

암호를 저장하지만 백엔드 요청을 전혀 실행하지 않습니다. 직접 추가해야하나요? 내가 아는 한 이걸 ._ 수퍼 (데이터); 백엔드에 대한 요청을 실행해야합니다. 내가 맞습니까? – user3874216

+0

예, 슈퍼 콜은 인증자를 호출하여 요청을 백엔드에 보냅니다. – marcoow

+0

코드를 복사하지만 백엔드에 요청을 보내지 않습니다. LoginControllerMixin을 추가하고이 함수를 작성하면 작동합니다. – user3874216