summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-12-17 12:44:46 -0500
committerJoramWilander <jwawilander@gmail.com>2015-12-17 12:44:46 -0500
commita6ae90ac2a74871331707751e823b4746136ff09 (patch)
tree2651cc8adfeca84a0ee89974ba6c40f167a81123 /web/react/utils
parent58358ddd7cd0152bf16a7326e1d595524fb51246 (diff)
downloadchat-a6ae90ac2a74871331707751e823b4746136ff09.tar.gz
chat-a6ae90ac2a74871331707751e823b4746136ff09.tar.bz2
chat-a6ae90ac2a74871331707751e823b4746136ff09.zip
Add ability to switch between SSO and email account
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/client.jsx34
-rw-r--r--web/react/utils/constants.jsx2
2 files changed, 36 insertions, 0 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index a12e85f67..2a90da168 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -228,6 +228,40 @@ export function resetPassword(data, success, error) {
track('api', 'api_users_reset_password');
}
+export function switchToSSO(data, success, error) {
+ $.ajax({
+ url: '/api/v1/users/switch_to_sso',
+ 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);
+ error(e);
+ }
+ });
+
+ track('api', 'api_users_switch_to_sso');
+}
+
+export function switchToEmail(data, success, error) {
+ $.ajax({
+ url: '/api/v1/users/switch_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);
+ error(e);
+ }
+ });
+
+ track('api', 'api_users_switch_to_email');
+}
+
export function logout() {
track('api', 'api_users_logout');
var currentTeamUrl = TeamStore.getCurrentTeamUrl();
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx
index 29c5ecc5d..fa5fa8e8d 100644
--- a/web/react/utils/constants.jsx
+++ b/web/react/utils/constants.jsx
@@ -116,6 +116,8 @@ export default {
GITLAB_SERVICE: 'gitlab',
GOOGLE_SERVICE: 'google',
EMAIL_SERVICE: 'email',
+ SIGNIN_CHANGE: 'signin_change',
+ SIGNIN_VERIFIED: 'verified',
POST_CHUNK_SIZE: 60,
MAX_POST_CHUNKS: 3,
POST_FOCUS_CONTEXT_RADIUS: 10,