summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx26
-rw-r--r--web/react/utils/client.jsx36
-rw-r--r--web/react/utils/constants.jsx6
-rw-r--r--web/react/utils/markdown.jsx2
4 files changed, 67 insertions, 3 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 5378a2ba6..970b1a4c0 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -312,6 +312,32 @@ export function getLogs() {
);
}
+export function getServerAudits() {
+ if (isCallInProgress('getServerAudits')) {
+ return;
+ }
+
+ callTracker.getServerAudits = utils.getTimestamp();
+ client.getServerAudits(
+ (data, textStatus, xhr) => {
+ callTracker.getServerAudits = 0;
+
+ if (xhr.status === 304 || !data) {
+ return;
+ }
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECIEVED_SERVER_AUDITS,
+ audits: data
+ });
+ },
+ (err) => {
+ callTracker.getServerAudits = 0;
+ dispatchError(err, 'getServerAudits');
+ }
+ );
+}
+
export function getConfig() {
if (isCallInProgress('getConfig')) {
return;
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 855de3fc2..992337671 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -305,6 +305,28 @@ export function loginByEmail(name, email, password, success, error) {
});
}
+export function loginByUsername(name, username, password, success, error) {
+ $.ajax({
+ url: '/api/v1/users/login',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify({name, username, password}),
+ success: function onSuccess(data, textStatus, xhr) {
+ track('api', 'api_users_login_success', data.team_id, 'username', data.username);
+ sessionStorage.removeItem(data.id + '_last_error');
+ BrowserStore.signalLogin();
+ success(data, textStatus, xhr);
+ },
+ error: function onError(xhr, status, err) {
+ track('api', 'api_users_login_fail', name, 'username', username);
+
+ var e = handleError('loginByUsername', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
export function loginByLdap(teamName, id, password, success, error) {
$.ajax({
url: '/api/v1/users/login_ldap',
@@ -385,6 +407,20 @@ export function getLogs(success, error) {
});
}
+export function getServerAudits(success, error) {
+ $.ajax({
+ url: '/api/v1/admin/audits',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'GET',
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('getServerAudits', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
export function getConfig(success, error) {
$.ajax({
url: '/api/v1/admin/config',
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx
index e1a4b8a8a..11a8da669 100644
--- a/web/react/utils/constants.jsx
+++ b/web/react/utils/constants.jsx
@@ -45,6 +45,7 @@ export default {
RECIEVED_CONFIG: null,
RECIEVED_LOGS: null,
+ RECIEVED_SERVER_AUDITS: null,
RECIEVED_ALL_TEAMS: null,
SHOW_SEARCH: null,
@@ -84,7 +85,7 @@ export default {
SPECIAL_MENTIONS: ['channel'],
CHARACTER_LIMIT: 4000,
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg'],
- AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac'],
+ AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac', 'ogg'],
VIDEO_TYPES: ['mp4', 'avi', 'webm', 'mkv', 'wmv', 'mpg', 'mov', 'flv'],
PRESENTATION_TYPES: ['ppt', 'pptx'],
SPREADSHEET_TYPES: ['xlsx', 'csv'],
@@ -462,5 +463,6 @@ export default {
MIN_USERNAME_LENGTH: 3,
MAX_USERNAME_LENGTH: 15,
MIN_PASSWORD_LENGTH: 5,
- MAX_PASSWORD_LENGTH: 50
+ MAX_PASSWORD_LENGTH: 50,
+ TIME_SINCE_UPDATE_INTERVAL: 30000
};
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
index 826b87d08..47b3a9a66 100644
--- a/web/react/utils/markdown.jsx
+++ b/web/react/utils/markdown.jsx
@@ -134,7 +134,7 @@ class MattermostMarkdownRenderer extends marked.Renderer {
);
} else if (usedLanguage === 'tex' || usedLanguage === 'latex') {
try {
- const html = katex.renderToString(TextFormatting.sanitizeHtml(code), {throwOnError: false, displayMode: true});
+ const html = katex.renderToString(code, {throwOnError: false, displayMode: true});
return '<div class="post-body--code tex">' + html + '</div>';
} catch (e) {