I implemented ember-simple-auth to my project but I didn't find any info how to add client side validation to it. By default it pass all requests to backend.
In sessionAuthenticationFailed function I can handle all errors from backend but how I can add client-side validation?
My code is default in example but still mb I do something wrong.
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
You can simply override the App.LoginController
's authenticate
action and only call super
if your client side validations pass.