Skip to content

Instantly share code, notes, and snippets.

@jstrimpel
Created September 19, 2014 00:22
Show Gist options
  • Save jstrimpel/bca68962fab529851bb1 to your computer and use it in GitHub Desktop.
Save jstrimpel/bca68962fab529851bb1 to your computer and use it in GitHub Desktop.
lazo model authentication fn
// backs user model
define(['lazoSyncher'], function (LazoSyncher) {
return LazoSyncher.extend({
authenticate: function (credentials, options) {
// authenticate user using credentials
// you can call options.success or options.error
// update the user model, auth token, etc.
}
});
});
// in a controller that instantiated a user model
this.models.user.call('authenticate', {
success: function () {
// redirect user
},
error: function () {
// render authentication error in the UI
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment