Merge pull request #2135 from westlywright/2.0.7

2.0.7 Auth Bugs
This commit is contained in:
Vincent Fiduccia 2018-08-02 17:04:51 -07:00 committed by GitHub
commit a32539f766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 16 deletions

View File

@ -22,7 +22,7 @@ export default Mixin.create({
providerName: null, providerName: null,
actions: { actions: {
authTest() { authTest(cb) {
this.send('clearError'); this.send('clearError');
const model = get(this, 'authConfig'); const model = get(this, 'authConfig');
@ -39,6 +39,7 @@ export default Mixin.create({
}); });
set(model, 'enabled', false); set(model, 'enabled', false);
cb(false);
} else { } else {
set(this, 'testing', true); set(this, 'testing', true);
@ -49,14 +50,21 @@ export default Mixin.create({
model.save().then(() => { model.save().then(() => {
model.doAction('testAndEnable', { finalRedirectUrl: `${ window.location.origin }/verify-auth?config=${ get(this, 'providerName') }` }).then( ( resp ) => { model.doAction('testAndEnable', { finalRedirectUrl: `${ window.location.origin }/verify-auth?config=${ get(this, 'providerName') }` }).then( ( resp ) => {
get(this, 'saml').test(resp, () => { get(this, 'saml').test(resp, (popupResults) => {
if (popupResults.type === 'error') {
this.set('errors', [popupResults.message]);
cb(false);
} else {
this.send('waitAndRefresh'); this.send('waitAndRefresh');
}
}); });
}).catch((err) => { }).catch((err) => {
this.set('errors', [err]); this.set('errors', [err]);
cb(false);
}); });
}).catch((err) => { }).catch((err) => {
this.set('errors', [err]); this.set('errors', [err]);
cb(false);
}); });
} }
}, },

View File

@ -48,8 +48,9 @@ export default Service.extend({
url = Util.addQueryParams(url, additionalRedirectParams); url = Util.addQueryParams(url, additionalRedirectParams);
const popup = window.open(url, 'rancherAuth', Util.popupWindowOptions()); const popup = window.open(url, 'rancherAuth', Util.popupWindowOptions());
const intl = get(this, 'intl');
const timer = setInterval(function() { const timer = setInterval(() => {
if (popup && popup.closed ) { if (popup && popup.closed ) {
clearInterval(timer); clearInterval(timer);
@ -58,7 +59,7 @@ export default Service.extend({
cb({ cb({
type: 'error', type: 'error',
message: get(this, 'intl').t('authPage.azuread.test.authError') message: intl.t('authPage.azuread.test.authError')
}); });
} }
} else if (popup === null || typeof (popup) === 'undefined') { } else if (popup === null || typeof (popup) === 'undefined') {
@ -69,7 +70,7 @@ export default Service.extend({
cb({ cb({
type: 'error', type: 'error',
message: get(this, 'intl').t('authPage.azuread.test.popupError') message: intl.t('authPage.azuread.test.popupError')
}); });
} }
} }

View File

@ -213,6 +213,13 @@ export default Component.extend(ClusterDriver, {
this.loadSubnets(auth).catch((err) => { this.loadSubnets(auth).catch((err) => {
get(this, 'errors').pushObject(err); get(this, 'errors').pushObject(err);
}); });
} else if (mode === 'default') {
setProperties(get(this, 'config'), {
virtualNetwork: null,
subnets: [],
});
set(this, 'step', 3);
} }
}), }),
@ -222,7 +229,7 @@ export default Component.extend(ClusterDriver, {
subnetName: nameFromResource(subnet, 'SubnetId'), subnetName: nameFromResource(subnet, 'SubnetId'),
subnetId: subnet.SubnetId, subnetId: subnet.SubnetId,
} }
}); }).sortBy('subnetName');
}), }),
@ -232,11 +239,11 @@ export default Component.extend(ClusterDriver, {
id: get(vpc, 'VpcId'), id: get(vpc, 'VpcId'),
label: `${ get(vpc, 'VpcId') } (${ get(vpc, 'CidrBlock') })` label: `${ get(vpc, 'VpcId') } (${ get(vpc, 'CidrBlock') })`
}; };
}); }).sortBy('label');
}), }),
filteredSecurityGroups: computed('allSecurityGroups', function() { filteredSecurityGroups: computed('allSecurityGroups', function() {
return get(this, 'allSecurityGroups').filterBy('VpcId', get(this, 'config.virtualNetwork')); return get(this, 'allSecurityGroups').filterBy('VpcId', get(this, 'config.virtualNetwork')).sortBy('GroupName');
}), }),
readableServiceRole: computed('config.serviceRole', function() { readableServiceRole: computed('config.serviceRole', function() {

View File

@ -70,9 +70,10 @@ export default Service.extend({
let url = Util.addQueryParams(`${ window.location.origin }/verify-auth`, { config: 'github', }); let url = Util.addQueryParams(`${ window.location.origin }/verify-auth`, { config: 'github', });
let popup = window.open(url, 'rancherAuth', Util.popupWindowOptions()); const popup = window.open(url, 'rancherAuth', Util.popupWindowOptions());
const intl = get(this, 'intl');
let timer = setInterval(function() { let timer = setInterval(() => {
if (popup && popup.closed ) { if (popup && popup.closed ) {
clearInterval(timer); clearInterval(timer);
@ -80,7 +81,7 @@ export default Service.extend({
responded = true; responded = true;
cb({ cb({
type: 'error', type: 'error',
message: get(this, 'intl').t('authPage.github.test.authError') message: intl.t('authPage.github.test.authError')
}); });
} }
} else if (popup === null || typeof (popup) === 'undefined') { } else if (popup === null || typeof (popup) === 'undefined') {
@ -91,7 +92,7 @@ export default Service.extend({
cb({ cb({
type: 'error', type: 'error',
message: get(this, 'intl').t('authPage.github.test.popupError') message: intl.t('authPage.github.test.popupError')
}); });
} }
} }

View File

@ -39,7 +39,9 @@ export default Service.extend({
let url = get(config, 'idpRedirectUrl'); let url = get(config, 'idpRedirectUrl');
let popup = window.open(url, 'rancherAuth', Util.popupWindowOptions()); let popup = window.open(url, 'rancherAuth', Util.popupWindowOptions());
let timer = setInterval(function() { const intl = get(this, 'intl');
let timer = setInterval(() => {
if (popup && popup.closed ) { if (popup && popup.closed ) {
clearInterval(timer); clearInterval(timer);
@ -48,7 +50,7 @@ export default Service.extend({
cb({ cb({
type: 'error', type: 'error',
message: get(this, 'intl').t('authPage.saml.authError') message: intl.t('authPage.saml.authError')
}); });
} }
} else if (popup === null || typeof (popup) === 'undefined') { } else if (popup === null || typeof (popup) === 'undefined') {
@ -59,7 +61,7 @@ export default Service.extend({
cb({ cb({
type: 'error', type: 'error',
message: get(this, 'intl').t('authPage.saml.popupError') message: intl.t('authPage.saml.popupError')
}); });
} }
} }