Create a gist now

Instantly share code, notes, and snippets.

@velveteer /ldap_login.ls Secret
Last active Aug 29, 2015

What would you like to do?
Meteor LDAPS Client
Meteor.ldapLogin = (username, password, callback) ->
loginRequest =
username: username
password: password
Accounts.callLoginMethod do
methodArguments: [loginRequest]
userCallback: callback
Template.login.events do
'submit #login-form': (event, template) ->
Session.set 'errorMessage', null
event.preventDefault!
Meteor.ldapLogin do
template.find('#login-username').value
template.find('#login-password').value
(error) ->
Session.set 'errorMessage', 'Login failed'
Template.logout.displayName = ->
user = Meteor.user!
if !user
''
if user.username
user.username
if user.profile and user.profile.name
user.profile.name
Template.logout.events do
'click #logout-button': (event, template) ->
Session.set 'errorMessage', null
event.preventDefault!
Meteor.logout (error) ->
error
Template.errorMessage.errorMessage = -> Session.get 'errorMessage'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment