2014-09-14 1 views
0

ember-simple-auth을 내 프로젝트에 구현했지만 클라이언트 측 유효성 검사를 추가하는 방법에 대한 정보를 찾지 못했습니다. 기본적으로 모든 요청을 백엔드로 전달합니다.ember-simple-auth에 클라이언트 측 유효성 검사를 추가하는 방법

sessionAuthenticationFailed 함수 백엔드에서 모든 오류를 처리 할 수 ​​있지만 클라이언트 쪽 유효성 검사를 추가 할 수있는 방법은 무엇입니까?

내 코드는 예제에서는 기본값이지만 여전히 mb입니다. 잘못된 것이 있습니다.

LoginController.coffee

App.LoginController = Em.Controller.extend(SimpleAuth.LoginControllerMixin, 
    authenticator: "simple-auth-authenticator:oauth2-password-grant" 
) 

LoginRoute.coffee

App.LoginRoute = Em.Route.extend 

    actions: 
    sessionAuthenticationFailed: (response) -> 
     console.log 'sessionAuthenticationFailed', response 

login.emblem

.b-content 

    .b-content__body 
    form.b-form submit='authenticate' 

     Ember.TextField id='identification' valueBinding='identification' class='b-form__input' 

     Ember.TextField id='password' type='password' valueBinding='password' class='b-form__input' 

     button.b-form__submit.b-button.b-button--primary.ts-submit type='submit' 
     | Enter 

답변

0

당신은 단순히 App.LoginControllerauthenticate 조치를 무시하고 경우에만 super를 호출 할 수 있습니다 클라이언트 측 유효성 검사가 통과됩니다.