little changes

This commit is contained in:
Evert Prants 2017-08-26 13:02:17 +03:00
parent 9b7bc571e0
commit 33944ae599
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
4 changed files with 11 additions and 8 deletions

View File

@ -332,6 +332,9 @@ const API = {
let auth = await models.OAuth2AuthorizedClient.query().where('user_id', user.id).andWhere('client_id', clientId)
if (!auth.length) return false
await models.OAuth2AccessToken.query().delete().where('client_id', clientId).andWhere('user_id', user.id)
await models.OAuth2RefreshToken.query().delete().where('client_id', clientId).andWhere('user_id', user.id)
for (let i in auth) {
await models.OAuth2AuthorizedClient.query().delete().where('id', auth[i].id)
}

View File

@ -129,7 +129,6 @@ const OAuthDB = {
await Models.OAuth2Code.query().delete().where('user_id', userId).andWhere('client_id', clientId)
const obj = { code: code, user_id: userId, client_id: clientId, scope: scope, expires_at: expr, created_at: new Date() }
console.log(obj)
await Models.OAuth2Code.query().insert(obj)

View File

@ -55,8 +55,11 @@ $(document).ready(function () {
if (!data.length) {
return $('#clientlist').html('There is nothing to show at this moment.')
}
var html = ''
$('#clientlist').html('')
for (var i in data) {
var html = ''
var client = data[i]
html += '<div class="authclient application" data-client-id="' + client.id + '" id="client-' + client.id + '">'
html += '<div class="remove" id="deleteclient"><i class="fa fa-fw fa-ban"></i></div>'
@ -75,13 +78,11 @@ $(document).ready(function () {
html += '<a class="url" href="' + client.url + '">' + client.url + '</a>'
html += '<div class="timestamp">Authorized ' + new Date(client.created_at) + '</div>'
html += '</div></div>'
}
$('#clientlist').html(html)
$('#clientlist').append(html)
for (let i in data) {
$('#client-' + data[i].id + ' #deleteclient').click(function (e) {
let clid = $(this).parent().data('client-id')
$('#client-' + client.id + ' #deleteclient').click(function (e) {
var clid = $(this).parent().data('client-id')
if (clid != null) {
removeAuthorization(clid)
}

View File

@ -61,7 +61,7 @@ block body
i.fa.fa-fw.fa-envelope
|Change Email Address
.clients
h2 OAuth2 Authorized Clients
h2 OAuth2 Authorized Applications
.cl#clientlist
span.load
i.fa.fa-spin.fa-spinner.fa-2x