summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-03-17 15:46:16 -0400
committerJoramWilander <jwawilander@gmail.com>2016-03-23 15:59:58 -0400
commit463fd8c20b6e20d1cc669810c339770b9b1ede41 (patch)
tree3bf857301e0a24a1a7ccd7c5d15834829e3d22e7 /webapp/utils
parent7af2e6f87a754312809aa044edd062930616401a (diff)
downloadchat-463fd8c20b6e20d1cc669810c339770b9b1ede41.tar.gz
chat-463fd8c20b6e20d1cc669810c339770b9b1ede41.tar.bz2
chat-463fd8c20b6e20d1cc669810c339770b9b1ede41.zip
Add the ability to switch from email to ldap and back
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/client.jsx50
-rw-r--r--webapp/utils/constants.jsx1
2 files changed, 43 insertions, 8 deletions
diff --git a/webapp/utils/client.jsx b/webapp/utils/client.jsx
index e29cf71d3..d42767d31 100644
--- a/webapp/utils/client.jsx
+++ b/webapp/utils/client.jsx
@@ -256,38 +256,72 @@ export function resetPassword(data, success, error) {
track('api', 'api_users_reset_password');
}
-export function switchToSSO(data, success, error) {
+export function emailToOAuth(data, success, error) {
$.ajax({
- url: '/api/v1/users/switch_to_sso',
+ url: '/api/v1/users/claim/email_to_oauth',
dataType: 'json',
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
success,
error: function onError(xhr, status, err) {
- var e = handleError('switchToSSO', xhr, status, err);
+ var e = handleError('emailToOAuth', xhr, status, err);
error(e);
}
});
- track('api', 'api_users_switch_to_sso');
+ track('api', 'api_users_email_to_oauth');
}
-export function switchToEmail(data, success, error) {
+export function oauthToEmail(data, success, error) {
$.ajax({
- url: '/api/v1/users/switch_to_email',
+ url: '/api/v1/users/claim/oauth_to_email',
dataType: 'json',
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
success,
error: function onError(xhr, status, err) {
- var e = handleError('switchToEmail', xhr, status, err);
+ var e = handleError('oauthToEmail', xhr, status, err);
error(e);
}
});
- track('api', 'api_users_switch_to_email');
+ track('api', 'api_users_oauth_to_email');
+}
+
+export function emailToLDAP(data, success, error) {
+ $.ajax({
+ url: '/api/v1/users/claim/email_to_ldap',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(data),
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('emailToLDAP', xhr, status, err);
+ error(e);
+ }
+ });
+
+ track('api', 'api_users_email_to_ldap');
+}
+
+export function ldapToEmail(data, success, error) {
+ $.ajax({
+ url: '/api/v1/users/claim/ldap_to_email',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(data),
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('ldapToEmail', xhr, status, err);
+ error(e);
+ }
+ });
+
+ track('api', 'api_users_ldap_to_email');
}
export function logout(success, error) {
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index 859348c73..ae9fdc5fb 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -185,6 +185,7 @@ export default {
OFFTOPIC_CHANNEL: 'off-topic',
GITLAB_SERVICE: 'gitlab',
GOOGLE_SERVICE: 'google',
+ LDAP_SERVICE: 'ldap',
EMAIL_SERVICE: 'email',
SIGNIN_CHANGE: 'signin_change',
SIGNIN_VERIFIED: 'verified',