Merge pull request #381 from mattermost/mm-1705

MM-1705 add google as an oauth single-sign-on service
This commit is contained in:
Christopher Speller
2015-08-18 08:47:35 -04:00
17 changed files with 336 additions and 171 deletions

View File

@@ -396,7 +396,7 @@ function getMe() {
}
callTracker.getMe = utils.getTimestamp();
client.getMe(
client.getMeSynchronous(
function(data, textStatus, xhr) {
callTracker.getMe = 0;

View File

@@ -279,24 +279,33 @@ module.exports.getAudits = function(userId, success, error) {
});
};
module.exports.getMe = function(success, error) {
module.exports.getMeSynchronous = function(success, error) {
var currentUser = null;
$.ajax({
async: false,
url: "/api/v1/users/me",
dataType: 'json',
contentType: 'application/json',
type: 'GET',
success: success,
success: function gotUser(data, textStatus, xhr) {
currentUser = data;
if (success) {
success(data, textStatus, xhr);
}
},
error: function(xhr, status, err) {
var ieChecker = window.navigator.userAgent; // This and the condition below is used to check specifically for browsers IE10 & 11 to suppress a 200 'OK' error from appearing on login
if (xhr.status != 200 || !(ieChecker.indexOf("Trident/7.0") > 0 || ieChecker.indexOf("Trident/6.0") > 0)) {
if (error) {
e = handleError("getMe", xhr, status, err);
e = handleError('getMeSynchronous', xhr, status, err);
error(e);
};
};
}
});
return currentUser;
};
module.exports.inviteMembers = function(data, success, error) {

View File

@@ -58,6 +58,8 @@ module.exports = {
THUMBNAIL_HEIGHT: 100,
DEFAULT_CHANNEL: 'town-square',
OFFTOPIC_CHANNEL: 'off-topic',
GITLAB_SERVICE: 'gitlab',
GOOGLE_SERVICE: 'google',
POST_CHUNK_SIZE: 60,
MAX_POST_CHUNKS: 3,
RESERVED_TEAM_NAMES: [