fix redirectUrl after custom oauth successful login initiated by iframe command, fixes #5042 (#5043)

pull/5067/head
Fabio Montefuscolo 9 years ago committed by Rodrigo Nascimento
parent 136432299d
commit a68c2dedc6
  1. 9
      packages/rocketchat-ui/lib/iframeCommands.js

@ -19,12 +19,17 @@ const commands = {
}, event.origin);
};
if (typeof data.service === 'string') {
const siteUrl = Meteor.settings.Site_Url + '/';
if (typeof data.redirectUrl !== 'string' || !data.redirectUrl.startsWith(siteUrl)) {
data.redirectUrl = null;
}
if (typeof data.service === 'string' && window.ServiceConfiguration) {
const customOauth = ServiceConfiguration.configurations.findOne({service: data.service});
if (customOauth) {
const customLoginWith = Meteor['loginWith' + _.capitalize(customOauth.service, true)];
const customRedirectUri = window.OAuth._redirectUri(customOauth.service, customOauth);
const customRedirectUri = data.redirectUrl || siteUrl;
customLoginWith.call(Meteor, {'redirectUrl': customRedirectUri}, customOAuthCallback);
}
}

Loading…
Cancel
Save