mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-25 17:47:49 +00:00
27 lines
744 B
JavaScript
27 lines
744 B
JavaScript
import Controller from '@ember/controller';
|
|
import { computed, get, setProperties } from '@ember/object';
|
|
import { inject } from '@ember/service';
|
|
|
|
export default Controller.extend({
|
|
session: inject(),
|
|
|
|
username: computed.alias('name'),
|
|
|
|
password: computed.alias('pass'),
|
|
|
|
errorMessage: '',
|
|
|
|
actions: {
|
|
/**
|
|
* Using the session service, authenticate using the custom ldap authenticator
|
|
*/
|
|
authenticateUser() {
|
|
const { username, password } = this.getProperties(['username', 'password']);
|
|
|
|
get(this, 'session')
|
|
.authenticate('authenticator:custom-ldap', username, password)
|
|
.catch(({ responseText = 'Bad Credentials' }) => setProperties(this, { errorMessage: responseText }));
|
|
}
|
|
}
|
|
});
|