Initial version of admin panel, list users and reload user list works. No serious auth method yet, password is 'token123'

This commit is contained in:
Daniel García
2018-12-18 01:53:21 +01:00
parent 9a8cae836b
commit 5fecf09631
8 changed files with 228 additions and 6 deletions

127
src/static/admin.html Normal file
View File

@@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Bitwarden_rs Admin Panel</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.10.0/js/md5.js" integrity="sha256-tCQ/BldMlN2vWe5gAiNoNb5svoOgVUhlUgv7UjONKKQ="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/identicon.js/2.3.3/identicon.min.js" integrity="sha256-nYoL3nK/HA1e1pJvLwNPnpKuKG9q89VFX862r5aohmA="
crossorigin="anonymous"></script>
<style>
body { padding-top: 70px; }
img { width: 48px; height: 48px; }
#logo { width: 48px; height: 48px; }
</style>
<script>
let key = null;
function getIdenticon(email) {
const data = new Identicon(md5(email), {
size: 48,
format: 'svg'
}).toString();
return "data:image/svg+xml;base64," + data;
}
function loadUsers() {
$("#users-list").empty();
$.ajax({
type: "GET",
url: "/admin/users",
headers: { "Authorization": "Bearer " + key }
}).done(function (data) {
for (i in data) {
let user = data[i];
let row = $("#tmp-user-row").clone();
row.attr("id", "user-row:" + user.Id);
row.find(".tmp-user-name").text(user.Name);
row.find(".tmp-user-mail").text(user.Email);
row.find(".tmp-user-icon").attr("src", getIdenticon(user.Email))
row.find(".tmp-user-del").on("click", function (e) {
alert("Not Implemented: Deleting UUID " + user.Id);
});
row.appendTo("#users-list");
row.removeClass('d-none');
}
})
}
$(window).on('load', function () {
key = new URLSearchParams(window.location.search).get('key');
if (key) {
$("#no-key-form").addClass('d-none');
loadUsers();
} else {
$("#users-block").addClass('d-none');
}
});
</script>
</head>
<body class="bg-light">
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top shadow">
<a class="navbar-brand" href="#">Bitwarden_rs Admin</a>
<div class="navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Other</a>
</li>
</ul>
</div>
</nav>
<main class="container">
<div id="no-key-form" class="align-items-center p-3 mb-3 text-white-50 bg-danger rounded shadow">
<div>
<h6 class="mb-0 text-white">Authentication key needed to continue</h6>
<small>Please provide it below:</small>
<form class="form-inline" method="get">
<input type="text" class="form-control mr-2" id="key" name="key" placeholder="Enter admin key">
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<div id="users-block" class="my-3 p-3 bg-white rounded shadow">
<h6 class="border-bottom pb-2 mb-0">Registered Users</h6>
<div id="users-list"></div>
<small class="d-block text-right mt-3">
<a href="#" onclick="loadUsers();">Reload users</a>
</small>
</div>
<div id="tmp-user-row" class="d-none media pt-3">
<img src="#" alt="identicon" class="mr-2 rounded tmp-user-icon">
<div class="media-body pb-3 mb-0 small border-bottom">
<div class="d-flex justify-content-between">
<strong class="tmp-user-name">Full Name</strong>
<a class="tmp-user-del mr-3" href="#">Delete User</a>
</div>
<span class="d-block tmp-user-mail">Email</span>
</div>
</div>
</main>
</body>
</html>

View File

@@ -0,0 +1,767 @@
[
{
"Type": 2,
"Domains": [
"ameritrade.com",
"tdameritrade.com"
],
"Excluded": false
},
{
"Type": 3,
"Domains": [
"bankofamerica.com",
"bofa.com",
"mbna.com",
"usecfo.com"
],
"Excluded": false
},
{
"Type": 4,
"Domains": [
"sprint.com",
"sprintpcs.com",
"nextel.com"
],
"Excluded": false
},
{
"Type": 0,
"Domains": [
"youtube.com",
"google.com",
"gmail.com"
],
"Excluded": false
},
{
"Type": 1,
"Domains": [
"apple.com",
"icloud.com"
],
"Excluded": false
},
{
"Type": 5,
"Domains": [
"wellsfargo.com",
"wf.com"
],
"Excluded": false
},
{
"Type": 6,
"Domains": [
"mymerrill.com",
"ml.com",
"merrilledge.com"
],
"Excluded": false
},
{
"Type": 7,
"Domains": [
"accountonline.com",
"citi.com",
"citibank.com",
"citicards.com",
"citibankonline.com"
],
"Excluded": false
},
{
"Type": 8,
"Domains": [
"cnet.com",
"cnettv.com",
"com.com",
"download.com",
"news.com",
"search.com",
"upload.com"
],
"Excluded": false
},
{
"Type": 9,
"Domains": [
"bananarepublic.com",
"gap.com",
"oldnavy.com",
"piperlime.com"
],
"Excluded": false
},
{
"Type": 10,
"Domains": [
"bing.com",
"hotmail.com",
"live.com",
"microsoft.com",
"msn.com",
"passport.net",
"windows.com",
"microsoftonline.com",
"office365.com",
"microsoftstore.com"
],
"Excluded": false
},
{
"Type": 11,
"Domains": [
"ua2go.com",
"ual.com",
"united.com",
"unitedwifi.com"
],
"Excluded": false
},
{
"Type": 12,
"Domains": [
"overture.com",
"yahoo.com",
"flickr.com"
],
"Excluded": false
},
{
"Type": 13,
"Domains": [
"zonealarm.com",
"zonelabs.com"
],
"Excluded": false
},
{
"Type": 14,
"Domains": [
"paypal.com",
"paypal-search.com"
],
"Excluded": false
},
{
"Type": 15,
"Domains": [
"avon.com",
"youravon.com"
],
"Excluded": false
},
{
"Type": 16,
"Domains": [
"diapers.com",
"soap.com",
"wag.com",
"yoyo.com",
"beautybar.com",
"casa.com",
"afterschool.com",
"vine.com",
"bookworm.com",
"look.com",
"vinemarket.com"
],
"Excluded": false
},
{
"Type": 17,
"Domains": [
"1800contacts.com",
"800contacts.com"
],
"Excluded": false
},
{
"Type": 18,
"Domains": [
"amazon.com",
"amazon.co.uk",
"amazon.ca",
"amazon.de",
"amazon.fr",
"amazon.es",
"amazon.it",
"amazon.com.au",
"amazon.co.nz",
"amazon.co.jp",
"amazon.in"
],
"Excluded": false
},
{
"Type": 19,
"Domains": [
"cox.com",
"cox.net",
"coxbusiness.com"
],
"Excluded": false
},
{
"Type": 20,
"Domains": [
"mynortonaccount.com",
"norton.com"
],
"Excluded": false
},
{
"Type": 21,
"Domains": [
"verizon.com",
"verizon.net"
],
"Excluded": false
},
{
"Type": 22,
"Domains": [
"rakuten.com",
"buy.com"
],
"Excluded": false
},
{
"Type": 23,
"Domains": [
"siriusxm.com",
"sirius.com"
],
"Excluded": false
},
{
"Type": 24,
"Domains": [
"ea.com",
"origin.com",
"play4free.com",
"tiberiumalliance.com"
],
"Excluded": false
},
{
"Type": 25,
"Domains": [
"37signals.com",
"basecamp.com",
"basecamphq.com",
"highrisehq.com"
],
"Excluded": false
},
{
"Type": 26,
"Domains": [
"steampowered.com",
"steamcommunity.com",
"steamgames.com"
],
"Excluded": false
},
{
"Type": 27,
"Domains": [
"chart.io",
"chartio.com"
],
"Excluded": false
},
{
"Type": 28,
"Domains": [
"gotomeeting.com",
"citrixonline.com"
],
"Excluded": false
},
{
"Type": 29,
"Domains": [
"gogoair.com",
"gogoinflight.com"
],
"Excluded": false
},
{
"Type": 30,
"Domains": [
"mysql.com",
"oracle.com"
],
"Excluded": false
},
{
"Type": 31,
"Domains": [
"discover.com",
"discovercard.com"
],
"Excluded": false
},
{
"Type": 32,
"Domains": [
"dcu.org",
"dcu-online.org"
],
"Excluded": false
},
{
"Type": 33,
"Domains": [
"healthcare.gov",
"cms.gov"
],
"Excluded": false
},
{
"Type": 34,
"Domains": [
"pepco.com",
"pepcoholdings.com"
],
"Excluded": false
},
{
"Type": 35,
"Domains": [
"century21.com",
"21online.com"
],
"Excluded": false
},
{
"Type": 36,
"Domains": [
"comcast.com",
"comcast.net",
"xfinity.com"
],
"Excluded": false
},
{
"Type": 37,
"Domains": [
"cricketwireless.com",
"aiowireless.com"
],
"Excluded": false
},
{
"Type": 38,
"Domains": [
"mandtbank.com",
"mtb.com"
],
"Excluded": false
},
{
"Type": 39,
"Domains": [
"dropbox.com",
"getdropbox.com"
],
"Excluded": false
},
{
"Type": 40,
"Domains": [
"snapfish.com",
"snapfish.ca"
],
"Excluded": false
},
{
"Type": 41,
"Domains": [
"alibaba.com",
"aliexpress.com",
"aliyun.com",
"net.cn",
"www.net.cn"
],
"Excluded": false
},
{
"Type": 42,
"Domains": [
"playstation.com",
"sonyentertainmentnetwork.com"
],
"Excluded": false
},
{
"Type": 43,
"Domains": [
"mercadolivre.com",
"mercadolivre.com.br",
"mercadolibre.com",
"mercadolibre.com.ar",
"mercadolibre.com.mx"
],
"Excluded": false
},
{
"Type": 44,
"Domains": [
"zendesk.com",
"zopim.com"
],
"Excluded": false
},
{
"Type": 45,
"Domains": [
"autodesk.com",
"tinkercad.com"
],
"Excluded": false
},
{
"Type": 46,
"Domains": [
"railnation.ru",
"railnation.de",
"rail-nation.com",
"railnation.gr",
"railnation.us",
"trucknation.de",
"traviangames.com"
],
"Excluded": false
},
{
"Type": 47,
"Domains": [
"wpcu.coop",
"wpcuonline.com"
],
"Excluded": false
},
{
"Type": 48,
"Domains": [
"mathletics.com",
"mathletics.com.au",
"mathletics.co.uk"
],
"Excluded": false
},
{
"Type": 49,
"Domains": [
"discountbank.co.il",
"telebank.co.il"
],
"Excluded": false
},
{
"Type": 50,
"Domains": [
"mi.com",
"xiaomi.com"
],
"Excluded": false
},
{
"Type": 52,
"Domains": [
"postepay.it",
"poste.it"
],
"Excluded": false
},
{
"Type": 51,
"Domains": [
"facebook.com",
"messenger.com"
],
"Excluded": false
},
{
"Type": 53,
"Domains": [
"skysports.com",
"skybet.com",
"skyvegas.com"
],
"Excluded": false
},
{
"Type": 54,
"Domains": [
"disneymoviesanywhere.com",
"go.com",
"disney.com",
"dadt.com"
],
"Excluded": false
},
{
"Type": 55,
"Domains": [
"pokemon-gl.com",
"pokemon.com"
],
"Excluded": false
},
{
"Type": 56,
"Domains": [
"myuv.com",
"uvvu.com"
],
"Excluded": false
},
{
"Type": 58,
"Domains": [
"mdsol.com",
"imedidata.com"
],
"Excluded": false
},
{
"Type": 57,
"Domains": [
"bank-yahav.co.il",
"bankhapoalim.co.il"
],
"Excluded": false
},
{
"Type": 59,
"Domains": [
"sears.com",
"shld.net"
],
"Excluded": false
},
{
"Type": 60,
"Domains": [
"xiami.com",
"alipay.com"
],
"Excluded": false
},
{
"Type": 61,
"Domains": [
"belkin.com",
"seedonk.com"
],
"Excluded": false
},
{
"Type": 62,
"Domains": [
"turbotax.com",
"intuit.com"
],
"Excluded": false
},
{
"Type": 63,
"Domains": [
"shopify.com",
"myshopify.com"
],
"Excluded": false
},
{
"Type": 64,
"Domains": [
"ebay.com",
"ebay.de",
"ebay.ca",
"ebay.in",
"ebay.co.uk",
"ebay.com.au"
],
"Excluded": false
},
{
"Type": 65,
"Domains": [
"techdata.com",
"techdata.ch"
],
"Excluded": false
},
{
"Type": 66,
"Domains": [
"schwab.com",
"schwabplan.com"
],
"Excluded": false
},
{
"Type": 68,
"Domains": [
"tesla.com",
"teslamotors.com"
],
"Excluded": false
},
{
"Type": 69,
"Domains": [
"morganstanley.com",
"morganstanleyclientserv.com",
"stockplanconnect.com",
"ms.com"
],
"Excluded": false
},
{
"Type": 70,
"Domains": [
"taxact.com",
"taxactonline.com"
],
"Excluded": false
},
{
"Type": 71,
"Domains": [
"mediawiki.org",
"wikibooks.org",
"wikidata.org",
"wikimedia.org",
"wikinews.org",
"wikipedia.org",
"wikiquote.org",
"wikisource.org",
"wikiversity.org",
"wikivoyage.org",
"wiktionary.org"
],
"Excluded": false
},
{
"Type": 72,
"Domains": [
"airbnb.at",
"airbnb.be",
"airbnb.ca",
"airbnb.ch",
"airbnb.cl",
"airbnb.co.cr",
"airbnb.co.id",
"airbnb.co.in",
"airbnb.co.kr",
"airbnb.co.nz",
"airbnb.co.uk",
"airbnb.co.ve",
"airbnb.com",
"airbnb.com.ar",
"airbnb.com.au",
"airbnb.com.bo",
"airbnb.com.br",
"airbnb.com.bz",
"airbnb.com.co",
"airbnb.com.ec",
"airbnb.com.gt",
"airbnb.com.hk",
"airbnb.com.hn",
"airbnb.com.mt",
"airbnb.com.my",
"airbnb.com.ni",
"airbnb.com.pa",
"airbnb.com.pe",
"airbnb.com.py",
"airbnb.com.sg",
"airbnb.com.sv",
"airbnb.com.tr",
"airbnb.com.tw",
"airbnb.cz",
"airbnb.de",
"airbnb.dk",
"airbnb.es",
"airbnb.fi",
"airbnb.fr",
"airbnb.gr",
"airbnb.gy",
"airbnb.hu",
"airbnb.ie",
"airbnb.is",
"airbnb.it",
"airbnb.jp",
"airbnb.mx",
"airbnb.nl",
"airbnb.no",
"airbnb.pl",
"airbnb.pt",
"airbnb.ru",
"airbnb.se"
],
"Excluded": false
},
{
"Type": 73,
"Domains": [
"eventbrite.at",
"eventbrite.be",
"eventbrite.ca",
"eventbrite.ch",
"eventbrite.cl",
"eventbrite.co.id",
"eventbrite.co.in",
"eventbrite.co.kr",
"eventbrite.co.nz",
"eventbrite.co.uk",
"eventbrite.co.ve",
"eventbrite.com",
"eventbrite.com.au",
"eventbrite.com.bo",
"eventbrite.com.br",
"eventbrite.com.co",
"eventbrite.com.hk",
"eventbrite.com.hn",
"eventbrite.com.pe",
"eventbrite.com.sg",
"eventbrite.com.tr",
"eventbrite.com.tw",
"eventbrite.cz",
"eventbrite.de",
"eventbrite.dk",
"eventbrite.fi",
"eventbrite.fr",
"eventbrite.gy",
"eventbrite.hu",
"eventbrite.ie",
"eventbrite.is",
"eventbrite.it",
"eventbrite.jp",
"eventbrite.mx",
"eventbrite.nl",
"eventbrite.no",
"eventbrite.pl",
"eventbrite.pt",
"eventbrite.ru",
"eventbrite.se"
],
"Excluded": false
},
{
"Type": 74,
"Domains": [
"stackexchange.com",
"superuser.com",
"stackoverflow.com",
"serverfault.com",
"mathoverflow.net"
],
"Excluded": false
}
]