From 58358ddd7cd0152bf16a7326e1d595524fb51246 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 8 Dec 2015 13:38:43 -0500 Subject: Some refactoring --- web/react/utils/client.jsx | 22 +++++++++++++++++++++- web/react/utils/constants.jsx | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'web/react/utils') diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index beabf5227..a12e85f67 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -243,7 +243,7 @@ export function loginByEmail(name, email, password, success, error) { dataType: 'json', contentType: 'application/json', type: 'POST', - data: JSON.stringify({name: name, email: email, password: password}), + data: JSON.stringify({name, email, password}), success: function onSuccess(data, textStatus, xhr) { track('api', 'api_users_login_success', data.team_id, 'email', data.email); BrowserStore.signalLogin(); @@ -258,6 +258,26 @@ export function loginByEmail(name, email, password, success, error) { }); } +export function loginByLdap(teamName, id, password, success, error) { + $.ajax({ + url: '/api/v1/users/login_ldap', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify({teamName, id, password}), + success: function onSuccess(data, textStatus, xhr) { + track('api', 'api_users_loginLdap_success', data.team_id, 'id', id); + success(data, textStatus, xhr); + }, + error: function onError(xhr, status, err) { + track('api', 'api_users_loginLdap_fail', teamName, 'id', id); + + var e = handleError('loginByLdap', xhr, status, err); + error(e); + } + }); +} + export function revokeSession(altId, success, error) { $.ajax({ url: '/api/v1/users/revoke_session', diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index 5f027a409..29c5ecc5d 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -114,6 +114,7 @@ export default { DEFAULT_CHANNEL: 'town-square', OFFTOPIC_CHANNEL: 'off-topic', GITLAB_SERVICE: 'gitlab', + GOOGLE_SERVICE: 'google', EMAIL_SERVICE: 'email', POST_CHUNK_SIZE: 60, MAX_POST_CHUNKS: 3, -- cgit v1.2.3-1-g7c22