Skip to content

Commit

Permalink
fix redirectUrl after custom oauth successful login initiated by ifra…
Browse files Browse the repository at this point in the history
…me command, fixes #5042 (#5043)
  • Loading branch information
fabiomontefuscolo authored and rodrigok committed Nov 29, 2016
1 parent 1364322 commit a68c2de
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/rocketchat-ui/lib/iframeCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit a68c2de

Please sign in to comment.