auth and log domains
This commit is contained in:
parent
970a616591
commit
44bfc02fa1
|
@ -1,17 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<html ng-app="com.daplie.cloud" ng-strict>
|
||||
<head>
|
||||
<link type="text/css" rel="stylesheet" href="/assets/com.bootstrapcdn/spacelab/bootstrap.css">
|
||||
</head>
|
||||
<body>
|
||||
<body class="fade" ng-class="[ 'in' ]">
|
||||
|
||||
Do admin stuff:
|
||||
|
||||
<div ng-controller="LoginController as vm">
|
||||
<button type="button" ng-click="vm.authenticate()">Login</button>
|
||||
<div ng-controller="LoginController as vm" ng-init="vm.setSimple()">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-link"
|
||||
ng-if="!vm.advanced"
|
||||
ng-click="vm.setAdvanced()"
|
||||
>advanced</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-link"
|
||||
ng-if="vm.advanced"
|
||||
ng-click="vm.setSimple();"
|
||||
>simple</button>
|
||||
<input
|
||||
type="text"
|
||||
ng-if="vm.advanced"
|
||||
ng-change="vm.checkProviderUri(vm.myProviderUri)"
|
||||
ng-model="vm.myProviderUri">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
ng-disabled="vm.advanced && !vm.providerUri"
|
||||
ng-click="vm.authenticate()"
|
||||
>Login</button>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li>Login to Daplie</li>
|
||||
<li>Show domains (or ask purchase)</li>
|
||||
<li>Tunnel On</li>
|
||||
<li>Show configured domains</li>
|
||||
</ul>
|
||||
|
@ -19,7 +43,8 @@
|
|||
<script src="/assets/com.jquery/jquery-3.1.1.js"></script>
|
||||
<script src="/assets/com.google/angular.1.6.2.min.js"></script>
|
||||
<script src="/assets/org.oauth3/oauth3.core.js"></script>
|
||||
<!-- script src="/assets/org.oauth3/oauth3.ng.js"></script -->
|
||||
<script src="/assets/org.oauth3/oauth3.ng.js"></script>
|
||||
<script src="/assets/org.oauth3/oauth3.domains.js"></script>
|
||||
<script src="/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -1,15 +1,46 @@
|
|||
angular.module('com.daplie.cloud', [])
|
||||
.service('oauth3', function () {
|
||||
var auth = window.OAUTH3.create();
|
||||
angular.module('com.daplie.cloud', [ 'org.oauth3' ])
|
||||
.service('oauth3', [ 'Oauth3', function (Oauth3) {
|
||||
var auth = Oauth3.create();
|
||||
auth.setProvider('oauth3.org');
|
||||
return auth;
|
||||
})
|
||||
.controller('LoginController', ['oauth3', function (oauth3) {
|
||||
} ])
|
||||
.controller('LoginController', [ '$timeout', 'oauth3', function ($timeout, oauth3) {
|
||||
var vm = this;
|
||||
|
||||
vm.setSimple = function () {
|
||||
vm.advanced = false;
|
||||
vm.providerUri = vm.providerUri || 'oauth3.org';
|
||||
};
|
||||
|
||||
vm.setAdvanced = function () {
|
||||
vm.advanced = true;
|
||||
vm.myProviderUri = vm.providerUri;
|
||||
};
|
||||
|
||||
vm.checkProviderUri = function (myProviderUri) {
|
||||
$timeout.cancel(vm.checkProviderTimeout);
|
||||
|
||||
vm.providerUri = null;
|
||||
vm.checkProviderTimeout = $timeout(function () {
|
||||
//var providerUri = vm.providerUri;
|
||||
|
||||
return oauth3.setProvider(myProviderUri).then(function (directives) {
|
||||
console.log('directives', directives);
|
||||
vm.providerUri = myProviderUri;
|
||||
}, function (err) {
|
||||
console.error('failed provider lookup', err);
|
||||
vm.checkProviderTimeout = null;
|
||||
});
|
||||
}, 250);
|
||||
};
|
||||
|
||||
vm.authenticate = function () {
|
||||
return oauth3.authenticate().then(function (session) {
|
||||
console.info("Authorized Session", session);
|
||||
|
||||
return oauth3.api('domains.list').then(function (domains) {
|
||||
console.info("domains owned", domains);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
Subproject commit 431bf019d807cdccec7937715987b2943e83c3a3
|
||||
Subproject commit 1e0d129b8a6748f635b6f6985d7dae2ece747e55
|
Loading…
Reference in New Issue