Merge branch 'oauth3' of git.daplie.com:Daplie/walnut_launchpad into oauth3

This commit is contained in:
aj 2017-08-22 18:38:09 +00:00
commit 0c26190e2a
14 changed files with 276 additions and 69 deletions

View File

@ -15,7 +15,6 @@
.login-container {
top: 25vh;
}
/* Common CSS */
.cp {
cursor: pointer;

View File

@ -11,17 +11,15 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
data: { requiresLogin: false },
url: '/splash-page',
templateUrl: '/templates/splash-page.html',
controller: 'loginCtrl',
controllerAs: 'vm'
controller: 'loginCtrl as vm'
})
.state('app',{
data: { requiresLogin: true },
url: '/',
controller: 'loginCtrl as vm',
views: {
'header': {
templateUrl: '/templates/partials/header.html',
controller: 'loginCtrl',
controllerAs: 'vm'
},
'menu': {
templateUrl: '/templates/partials/menu.html'
@ -36,8 +34,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/home.html',
controller: 'loginCtrl',
controllerAs: 'vm'
controller: 'loginCtrl as vm'
}
}
})
@ -46,8 +43,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/bolt.html',
controller: 'boltCtrl',
controllerAs: 'vm'
controller: 'boltCtrl as vm',
}
}
})
@ -56,8 +52,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/files.html',
controller: 'fileCtrl',
controllerAs: 'vm'
controller: 'fileCtrl as vm',
}
}
})
@ -66,8 +61,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/contacts.html',
controller: 'contactCtrl',
controllerAs: 'vm'
controller: 'contactCtrl as vm',
}
}
})
@ -76,8 +70,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/music.html',
controller: 'musicCtrl',
controllerAs: 'vm'
controller: 'musicCtrl as vm',
}
}
})
@ -86,8 +79,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/email.html',
controller: 'emailCtrl',
controllerAs: 'vm'
controller: 'emailCtrl as vm',
}
}
})
@ -96,8 +88,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/website.html',
controller: 'websiteCtrl',
controllerAs: 'vm'
controller: 'websiteCtrl as vm',
}
}
})
@ -107,7 +98,6 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
'content@': {
templateUrl: 'templates/dns.html',
controller: 'dnsCtrl',
controllerAs: 'vm'
}
}
})
@ -116,8 +106,7 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
views: {
'content@': {
templateUrl: 'templates/account-settings.html',
controller: 'loginCtrl',
controllerAs: 'vm'
controller: 'loginCtrl as vm',
}
}
});

View File

@ -3,8 +3,4 @@ app.controller('boltCtrl', [
function($scope, Auth) {
var vm = this;
vm.userName = function(profile){
profile = Auth.getProfile();
return profile.email;
};
}]);

View File

@ -1,4 +1,4 @@
app.controller('contactCrtl', [
app.controller('contactCtrl', [
'$scope',
function($scope) {

View File

@ -122,6 +122,10 @@ app.controller('loginCtrl', [
vm.newIssuer = vm.defaultIssuer;
vm.setIssuer(vm.defaultIssuer);
vm.getSession = function() {
return Auth.select(Auth.session);
};
vm.initListLoggedInProfiles = function () {
vm.activeProfiles = Auth.getActiveSessions();
};
@ -136,13 +140,15 @@ app.controller('loginCtrl', [
};
vm.signOut = function () {
// TODO the sign-out url for each account should be fixed.
return Auth.signOut().then(function () {
if (Auth.sessions.length === 0) {
$location.path('/splash-page');
return;
}
window.alert("You are still logged in with other accounts.");
vm.getSession().then(function(){
// TODO the sign-out url for each account should be fixed.
return Auth.signOut().then(function () {
if (Auth.sessions.length === 0) {
$location.path('/splash-page');
return;
}
window.alert("You are still logged in with other accounts.");
});
});
};

View File

@ -64,12 +64,11 @@ app.factory('Auth', [
Auth.sessions.push(session);
});
return Auth.session;
}
, select: function (session) {
if (!session.issuer) {
throw new Error("session doesn't have an issuer");;
throw new Error("session doesn't have an issuer");
}
var name = session.token.sub + '@' + session.token.iss;
@ -108,7 +107,6 @@ app.factory('Auth', [
, signOut: function () {
var session = Auth.session;
var dapName = 'dap-' + session.subject + '|' + session.issuer;
// TODO logout url should be created upon login and remain fixed throughout the duration of the session (or on session restoration)
return Auth.oauth3.logout().then(function () {
var obj = JSON.parse(localStorage.getItem(dapSessions) || '{}');

View File

@ -7,7 +7,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
add: function (opts) {
var providerUri = opts.audience;
var session = opts.session;
debugger;
return OAUTH3.request({
method: 'POST'
, url: OAUTH3.url.normalize(providerUri)

View File

@ -1,7 +1,5 @@
<h1 class="text-center">Account Settings</h1>
<div class="row">
<!-- left column -->
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="text-center">
<img src="http://s3.amazonaws.com/37assets/svn/765-default-avatar.png" class="avatar img-circle img-thumbnail" alt="avatar">
@ -9,9 +7,7 @@
<input type="file" class="text-center center-block well well-sm">
</div>
</div>
<!-- edit form column -->
<div class="col-md-8 col-sm-6 col-xs-12 personal-info">
<h3>Personal Info</h3>
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-lg-3 control-label">First name:</label>
@ -28,7 +24,7 @@
<div class="form-group">
<label class="col-lg-3 control-label">Email:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="{{ vm.session.subject }}" disabled>
<input class="form-control" type="email" value="{{ vm.session.subject }}" disabled>
</div>
</div>
</form>
@ -60,7 +56,7 @@
<a class="btn btn-default btn-sm" ng-click="vm.selectSession(session);">Use Account</a>
</div>
<div class="col-md-6">
<a class="btn btn-default btn-sm pull-right" ng-click="vm.signOut()">Sign Out</a>
<a class="btn btn-default btn-sm pull-right" ng-if="vm.session.subject == session.subject" ng-click="vm.signOut()">Sign Out</a>
</div>
</div>
</div>

View File

@ -1,12 +1,243 @@
<h2>Contacts</h2>
<div class="home-container">
<ul>
<li ng-repeat="contact in contacts">
<div ng-hide="vm.single_contact">
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="!#contacts" class="quick-create-tab" aria-controls="contacts" role="tab" data-toggle="tab"><i class="fa fa-user-plus" aria-hidden="true"></i> Create contact</a></li>
<li role="presentation"><a href="!#groups" class="quick-create-tab" aria-controls="conversate" role="tab" data-toggle="tab"><i class="fa fa-users" aria-hidden="true"></i> Create a group</a></li>
<li role="presentation"><a href="!#import_contacts" class="quick-create-tab" aria-controls="conversate" role="tab" data-toggle="tab"><i class="fa fa-users" aria-hidden="true"></i> Import Contacts</a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="contacts">
<div ng-hide="vm.contact_active" ng-click="vm.contact_active = true">
<input type="text" class="form-control" placeholder="First Name">
</div>
<div ng-show="vm.contact_active" class="media">
<div class="media-left">
<div class="image-thing"><i class="fa fa-user fa-3x" aria-hidden="true"></i></div>
</div>
<div class="media-body">
<div class="form-group">
<input type="text" class="form-control" placeholder="First Name">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Last Name">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Mobile Number">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Email or Daplie Address">
</div>
<div class="form-group">
<textarea name="name" class="form-control" rows="8" cols="80" placeholder="Notes"></textarea>
<br>
<div class="pull-right">
<button ng-click="vm.contact_active = false" type="button" name="button" class="btn btn-default">Save</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<a ui-sref=".detail({ id: contact.id })" > {{ contact.name }}</a>
{{ contact.email }}
<div ng-hide="vm.contacts_imported" class="contact-zero">
<div class="contact-zero-main">
</li>
</ul>
<i class="fa fa-users fa-4x"></i>
<div ui-view="detail"></div>
<h3>You haven't added any contacts yet!</h3>
</div>
<div class="contact-zero-buttons button-container">
<button ng-click="vm.import_contacts()" class="btn btn-default" type="button">Import from Gmail</button>
</div>
</div>
<div ng-show="vm.contacts_imported">
<h4 class="text-center">Importing Contacts...</h4>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="30"
aria-valuemin="0" aria-valuemax="100" style="width:30%">
<span class="sr-only">30% Complete</span>
</div>
</div>
<h3 class="text-center">Recent Contacts</h3>
<table class="table">
<tr>
<td><button ng-click="vm.single_contact = true" class="btn btn-default">View</button></td>
<td>Best Friend</td>
<td>best@frind.com</td>
<td>555-555-5309</td>
</tr>
<tr>
<td><button ng-click="vm.single_contact = true" class="btn btn-default">View</button></td>
<td>Notbest Friend</td>
<td>not@best.com</td>
<td>555-867-5555</td>
</tr>
<tr>
<td><button ng-click="vm.single_contact = true" class="btn btn-default">View</button></td>
<td>Uncle Ben</td>
<td>uncle@ben.com</td>
<td>555-867-1234</td>
</tr>
</table>
<h3 class="text-center">Core to reconnect with these old friends?</h3>
<div class="contact-suggest">
<table class="table">
<tr>
<td>John Doe</td>
<td>john@doe.com</td>
<td>555-867-5309</td>
<td>
<button class="btn btn-sm">Send a message</button>
<button ng-click="vm.unlock('godfather')" class="btn btn-sm btn-danger">Nah</button>
</td>
</tr>
<tr>
<td>Bob Smith</td>
<td>bob@smith.com</td>
<td>555-867-5308</td>
<td>
<button class="btn btn-sm">Send a message</button>
<button ng-click="vm.unlock('godfather')" class="btn btn-sm btn-danger">Nah</button>
</td>
</tr>
<tr>
<td>Jane Austin</td>
<td>jane@austin.com</td>
<td>555-867-5307</td>
<td>
<button class="btn btn-sm">Send a message</button>
<button ng-click="vm.unlock('godfather')" class="btn btn-sm btn-danger">Nah</button>
</td>
</tr>
</table>
</div>
</div>
</div>
<div ng-show="vm.single_contact">
<div class="contact-single-header">
<i class="fa fa-user fa-4x"></i>
<span class="contact-single-name">John Doe</span>
<div class="contact-single-info">
<p>john@doe.com</p>
<p>555-867-5309</p>
<button class="btn btn-primary">Send a Message</button>
</div>
</div>
<br/>
<br/>
<div class="panel panel-default">
<div class="panel-heading">
<div ng-init="vm.contact_view = 'messages'" class="flex-row space-around">
<div ng-click="vm.contact_view = 'messages'">
<p class="panel-title"><i class="fa fa-users" aria-hidden="true"></i> Conversations</p>
</div>
<span class="seperator">|</span>
<div ng-click="vm.contact_view = 'photos'">
<p class="panel-title"><i class="fa fa-photo" aria-hidden="true"></i> Photos</p>
</div>
<span class="seperator">|</span>
<div ng-click="vm.contact_view = 'files'">
<p class="panel-title"><i class="fa fa-file" aria-hidden="true"></i> Files</p>
</div>
<span class="seperator">|</span>
<p class="panel-title"><i class="fa fa-bars" aria-hidden="true"></i> More</p>
</div>
</div>
<div ng-show="'messages' === vm.contact_view" class="panel-body contact-bordered contact-conversation">
<p>Me: Hey John, did you know that you are my best friend?</p>
<p>John: No way! You're my best friend, too!</p>
<p>Me: Wow! We sure are awesome friends together! :)</p>
</div>
<div ng-show="'photos' === vm.contact_view" class="panel-body contact-bordered contact-photos">
<div class="col-lg-3"><i class="fa fa-4x fa-picture-o"></i></div>
<div class="col-lg-3"><i class="fa fa-4x fa-file-image-o"></i></div>
<div class="col-lg-3"><i class="fa fa-4x fa-file-image-o"></i></div>
<div class="col-lg-3"><i class="fa fa-4x fa-file-image-o"></i></div>
<div class="col-lg-3"><i class="fa fa-4x fa-picture-o"></i></div>
<div class="col-lg-3"><i class="fa fa-4x fa-file-image-o"></i></div>
<div class="col-lg-3"><i class="fa fa-4x fa-picture-o"></i></div>
</div>
<div ng-show="'files' === vm.contact_view" class="panel-body contact-bordered contact-files">
<div class="contact-file-placeholder">
<i class="fa fa-file fa-4x"></i>
<p>filename.ext</p>
</div>
<div class="contact-file-placeholder">
<i class="fa fa-file fa-4x"></i>
<p>filename.ext</p>
</div>
<div class="contact-file-placeholder">
<i class="fa fa-file fa-4x"></i>
<p>filename.ext</p>
</div>
<div class="contact-file-placeholder">
<i class="fa fa-file fa-4x"></i>
<p>filename.ext</p>
</div>
<div class="contact-file-placeholder">
<i class="fa fa-file fa-4x"></i>
<p>filename.ext</p>
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Remember when...?</h3>
</div>
<div class="panel-body contact-remember-body">
<div class="remember-item">
<div class="remember-item-header">Taken Feb 20, 2017</div>
<div class="remember-img-placeholder">
<i class="fa fa-photo fa-4x"></i>
</div>
</div>
<div class="remember-item">
<div class="remember-item-header">Sent on June 5, 2017</div>
<div class="remember-text-placeholder">
<p>Hey Jane,</p>
<p>Love the new do!</p>
<p>You're so lucky to have great<br/> hair I'm super jealous...</p>
</div>
</div>
<div class="remember-item">
<div class="remember-item-header">Shared on Ap...</div>
<div class="remember-music-placeholder">
<i class="fa fa-music fa-3x"></i>
<div class="remember-music-text">
<p>Come Fly with Me</p>
<p>Frank Sinatra</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -44,7 +44,7 @@
</thead>
-->
<tbody>
<tr ng-repeat="shared_artist in vm.shared_artists">
<tr ng-repeat="shared_artist in vm.shared_artists track by $index">
<td class="select-an-artist" ng-click="vm.get_artist(shared_artist)">{{ shared_artist }}</td>
<td>December 23, 2016</td>
<td><i class="fa fa-exchange js-sync-icon" aria-hidden="true"></i></td>
@ -61,7 +61,7 @@
</thead>
-->
<tbody>
<tr ng-repeat="artist in vm.artists">
<tr ng-repeat="artist in vm.artists track by $index">
<td class="select-an-artist" ng-click="vm.get_artist(artist)">{{ artist }}</td>
<td>June 13, 2017</td>
<td><i class="fa fa-exchange js-sync-icon" aria-hidden="true"></i></td>

View File

@ -1,13 +1,7 @@
<div notification-directive></div>
<div achievement-directive></div>
<div upload-directive></div>
<div class="panel panel-default">
<div class="panel-body">
<div class="media">
<h5 class="media-heading">System Message > Jane Smith {{ vm.userName() }}</h5>
<h5 class="media-heading">System Message > <span ng-bind="vm.session.subject"></span></h5>
<hr>
<div class="media-left">
<div class="image-thing"><i class="fa fa-bullhorn fa-3x" aria-hidden="true"></i></div>
@ -39,5 +33,3 @@
</div>
</div>
</div>
<div todo-directive></div>

View File

@ -1,4 +1,4 @@
<nav class="navbar navbar-default navbar-fixed-top">
<nav class="navbar navbar-default navbar-fixed-top" ng-controller="loginCtrl as vm">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
@ -28,7 +28,7 @@
<li role="separator" class="divider"></li>
<li ng-if="vm.sessions.length">Switch User</li>
<li ng-repeat="session in vm.sessions"><a ng-click="vm.selectSession(session)"><span ng-bind="session.subject">me@example.com</span> <i class="fa fa-user" aria-hidden="true"></i>
<li ng-repeat="session in vm.sessions track by $index"><a ng-click="vm.selectSession(session);"><span ng-bind="session.subject">me@example.com</span> <i class="fa fa-user" aria-hidden="true"></i>
<br><small ng-bind="session.issuer">example.com</small></a></li>
<li ng-if="vm.sessions.length" role="separator" class="divider"></li>

View File

@ -1,7 +1,7 @@
<section class="col-md-offset-4 col-md-4 login-container" ng-init="vm.initListLoggedInProfiles()">
<form>
<h4 class="text-center">Sign in</h4>
<a href="#!/home" class="current-user-container" ng-repeat="profile in vm.activeProfiles track by $index">
<a href="#!/home" class="current-user-container" ng-repeat="profile in vm.sessions track by $index" ng-click="vm.selectSession(profile);">
<div class="current-user-split"><i class="fa fa-user"></i></div>
<div class="current-user-text">Resume with {{ profile.email }}</div>
</a>

View File

@ -18,7 +18,7 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li ng-repeat="record in vm.records"><button class="btn btn-link" ng-bind="record.sub" ng-click="vm.selectRecord(record)">www</button></li>
<li ng-repeat="record in vm.records track by $index"><button class="btn btn-link" ng-bind="record.sub" ng-click="vm.selectRecord(record)">www</button></li>
</ul>
</div>
</div>
@ -31,7 +31,7 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li ng-repeat="domain in vm.domains"><button class="btn btn-link" ng-bind="domain.domain" ng-click="vm.selectDomain(domain)">example.com</button></li>
<li ng-repeat="domain in vm.domains track by $index"><button class="btn btn-link" ng-bind="domain.domain" ng-click="vm.selectDomain(domain)">example.com</button></li>
</ul>
</div>
</div>