fix some state issues
This commit is contained in:
parent
8a4b19928a
commit
37734638b8
|
@ -31,7 +31,7 @@ app.controller('websiteCtrl', [
|
||||||
|
|
||||||
return $q.all(Auth.sessions.map(function (session) {
|
return $q.all(Auth.sessions.map(function (session) {
|
||||||
|
|
||||||
return Auth.select(session).then(function (oauth3) {
|
return Auth.get(session).then(function (oauth3) {
|
||||||
|
|
||||||
return oauth3.api(apiname, {}).then(function (collection) {
|
return oauth3.api(apiname, {}).then(function (collection) {
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ app.controller('websiteCtrl', [
|
||||||
|
|
||||||
if (sess) {
|
if (sess) {
|
||||||
console.log('[pkg www] session selected', sess);
|
console.log('[pkg www] session selected', sess);
|
||||||
prom = Auth.select(sess).then(function (oauth3) {
|
prom = Auth.get(sess).then(function (oauth3) {
|
||||||
console.log('[pkg www] instance selected', oauth3);
|
console.log('[pkg www] instance selected', oauth3);
|
||||||
return oauth3.api('dns.set', { sld: sld, tld: tld, sub: ('' + result.data.prefix), type: 'TXT', ttl: 300, value: result.data.challenge });
|
return oauth3.api('dns.set', { sld: sld, tld: tld, sub: ('' + result.data.prefix), type: 'TXT', ttl: 300, value: result.data.challenge });
|
||||||
});
|
});
|
||||||
|
@ -238,10 +238,8 @@ app.controller('websiteCtrl', [
|
||||||
return $q.all(Auth.sessions.map(function (session) {
|
return $q.all(Auth.sessions.map(function (session) {
|
||||||
|
|
||||||
console.log('[www] select');
|
console.log('[www] select');
|
||||||
return Auth.select(session).then(function (oauth3) {
|
return Auth.get(session).then(function (oauth3) {
|
||||||
console.log('[www] oauth3', oauth3._resourceProviderDirectives);
|
|
||||||
var pkg = oauth3.pkg('www@daplie.com');
|
var pkg = oauth3.pkg('www@daplie.com');
|
||||||
console.log('[www] post pkg', oauth3._resourceProviderDirectives);
|
|
||||||
|
|
||||||
return pkg.list().then(function (result) {
|
return pkg.list().then(function (result) {
|
||||||
var _sites = result.data;
|
var _sites = result.data;
|
||||||
|
|
|
@ -66,7 +66,7 @@ app.factory('Auth', [
|
||||||
});
|
});
|
||||||
return Auth.session;
|
return Auth.session;
|
||||||
}
|
}
|
||||||
, select: function (session) {
|
, get: function (session) {
|
||||||
if (!session.issuer) {
|
if (!session.issuer) {
|
||||||
throw new Error("session doesn't have an issuer");
|
throw new Error("session doesn't have an issuer");
|
||||||
}
|
}
|
||||||
|
@ -97,12 +97,16 @@ app.factory('Auth', [
|
||||||
console.log('session.subject:', session.subject);
|
console.log('session.subject:', session.subject);
|
||||||
console.log('session:', session);
|
console.log('session:', session);
|
||||||
|
|
||||||
promise.then(function (oauth3) {
|
return promise;
|
||||||
|
}
|
||||||
|
, select: function (session) {
|
||||||
|
return Auth.get(session).then(function (oauth3) {
|
||||||
|
var dapName = 'dap-' + session.subject + '|' + session.issuer;
|
||||||
|
localStorage.setItem(dapSession, dapName);
|
||||||
|
|
||||||
Auth.session = session;
|
Auth.session = session;
|
||||||
Auth.oauth3 = oauth3;
|
Auth.oauth3 = oauth3;
|
||||||
})
|
});
|
||||||
|
|
||||||
return promise;
|
|
||||||
}
|
}
|
||||||
, signOut: function () {
|
, signOut: function () {
|
||||||
var session = Auth.session;
|
var session = Auth.session;
|
||||||
|
|
Loading…
Reference in New Issue