mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-10-25 14:40:19 -05:00
Fix #12967
This commit is contained in:
1 parent
2adba29c48
commit
f1c9efb5a8
4 files changed
+28
-68
No files matched your search
@@ -22,8 +22,8 @@ import "../../boot/bootstrap.js";
|
||||
import sidebar from "../../pages/shared/sidebar.js";
|
||||
import dates from "../shared/dates.js";
|
||||
import i18next from "i18next";
|
||||
import { api } from "../../boot/axios";
|
||||
import * as bootstrap from 'bootstrap';
|
||||
import {api} from "../../boot/axios";
|
||||
import {Modal} from 'bootstrap';
|
||||
import Alpine from "@alpinejs/csp";
|
||||
import formatDate from "../../util/format-date.js";
|
||||
|
||||
@@ -110,15 +110,14 @@ let index = function () {
|
||||
// console.log("getTokens()");
|
||||
api.get("./oauth/personal-access-tokens").then((response) => {
|
||||
// console.log(response.data);
|
||||
for(let i=0;i<response.data.length; i++) {
|
||||
if(Object.hasOwn(response.data, i)) {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
if (Object.hasOwn(response.data, i)) {
|
||||
let token = response.data[i];
|
||||
console.log(i18next.t("config.date_time_fns", { lng: locale }));
|
||||
token.expires_at = formatDate(new Date(token.expires_at), i18next.t("config.date_time_fns", { lng: locale }), locale);
|
||||
console.log(i18next.t("config.date_time_fns", {lng: locale}));
|
||||
token.expires_at = formatDate(new Date(token.expires_at), i18next.t("config.date_time_fns", {lng: locale}), locale);
|
||||
this.tokens.push(token);
|
||||
}
|
||||
}
|
||||
// this.tokens = response.data;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -126,26 +125,25 @@ let index = function () {
|
||||
* Show the form for creating new tokens.
|
||||
*/
|
||||
showCreateTokenForm() {
|
||||
// console.log("showCreateTokenForm()");
|
||||
new bootstrap.Modal(document.getElementById("modal-create-token"), {}).show();
|
||||
new Modal(document.getElementById("modal-create-token"), {}).show();
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new personal access token.
|
||||
*/
|
||||
storePat() {
|
||||
// console.log("storePat()");
|
||||
this.accessToken = null;
|
||||
|
||||
this.form.errors = [];
|
||||
|
||||
api.post("./oauth/personal-access-tokens", this.form)
|
||||
.then((response) => {
|
||||
console.log("Successful POST new token, reset form content.",);
|
||||
//console.log("Successful POST new token, reset form content.",);
|
||||
this.form.name = "";
|
||||
this.form.scopes = [];
|
||||
this.form.errors = [];
|
||||
|
||||
Modal.getInstance(document.getElementById('modal-create-token')).hide();
|
||||
|
||||
this.getTokens();
|
||||
this.showAccessToken(response.data.accessToken);
|
||||
})
|
||||
@@ -168,20 +166,8 @@ let index = function () {
|
||||
* Show the given access token to the user.
|
||||
*/
|
||||
showAccessToken(accessToken) {
|
||||
// console.log("showAccessToken");
|
||||
let modal = new bootstrap.Modal(document.getElementById("modal-create-token"), {});
|
||||
this.accessToken = accessToken;
|
||||
console.log('here we are', modal);
|
||||
// modal.toggle();
|
||||
// modal.toggle();
|
||||
|
||||
modal.addEventListener('hidden.bs.modal', function () {
|
||||
new Modal(document.getElementById("modal-access-token"), {}).show();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
new Modal(document.getElementById("modal-access-token"), {}).show();
|
||||
},
|
||||
getClients() {
|
||||
api.get("./oauth/clients").then((response) => {
|
||||
@@ -189,9 +175,7 @@ let index = function () {
|
||||
this.clients = response.data;
|
||||
});
|
||||
},
|
||||
showCreateClientForm() {
|
||||
new bootstrap.Modal(document.getElementById("modal-create-client"), {}).show();
|
||||
},
|
||||
|
||||
/**
|
||||
* Persist the client to storage using the given form.
|
||||
*/
|
||||
@@ -205,16 +189,10 @@ let index = function () {
|
||||
form.name = "";
|
||||
form.redirect_uris = "";
|
||||
form.errors = [];
|
||||
|
||||
document.addEventListener("hidden.bs.modal", function () {
|
||||
console.log('Closed??');
|
||||
});
|
||||
|
||||
new bootstrap.Modal('#' + modal, {}).hide();
|
||||
|
||||
Modal.getInstance(document.getElementById(modal)).hide();
|
||||
|
||||
if (response.data.plainSecret) {
|
||||
// this.showClientSecret(response.data.plainSecret);
|
||||
this.showClientSecret(response.data.plainSecret);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -226,7 +204,6 @@ let index = function () {
|
||||
} else {
|
||||
form.errors = ["Something went wrong. Please try again."];
|
||||
}
|
||||
//console.log(form.errors);
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -248,7 +225,7 @@ let index = function () {
|
||||
regenerateSecret(client) {
|
||||
api.post("./oauth/clients/regenerate/" + client.id).then((response) => {
|
||||
this.clientSecret = response.data.plainSecret;
|
||||
new Modal(document.getElementById("modal-client-secret"), {}).show();
|
||||
Modal.getInstance(document.getElementById("modal-client-secret"), {}).show();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -2771,7 +2771,7 @@ return [
|
||||
'(partially) reimburses' => '(partially) reimburses',
|
||||
'explain_related' => 'You can link transactions. The link doesn\'t do anything YET, but this is on my list.',
|
||||
'no_relations_yet' => 'This transaction has no relations to other transactions (yet).',
|
||||
'auto_save_active' => 'Changes are saved automatically.',
|
||||
'auto_save_active' => 'Changes are saved automatically in the background.',
|
||||
|
||||
// split a transaction:
|
||||
'splits' => 'Splits',
|
||||
|
||||
@@ -272,9 +272,11 @@
|
||||
<div class="modal-footer">
|
||||
<div class="row inline" style="width:100%;">
|
||||
<div class="col align-middle d-flex align-items-center">
|
||||
<template x-if="'edit' === formBehaviour.formType">
|
||||
<em><small>
|
||||
{{ __('firefly.auto_save_active') }}
|
||||
</small></em>
|
||||
</template>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button>
|
||||
|
||||
@@ -110,16 +110,13 @@
|
||||
</div>
|
||||
|
||||
<!-- Create Client Modal -->
|
||||
<div id="modal-create-client" class="modal fade" role="dialog" tabindex="-1">
|
||||
<div class="modal fade" tabindex="-1" id="modal-create-client">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
{{ __('firefly.profile_oauth_create_client') }}
|
||||
</h5>
|
||||
<h5 class="modal-title">{{ __('firefly.profile_oauth_create_client') }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ __('firefly.close') }}"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<!-- Form Errors -->
|
||||
<template x-if="createForm.errors.length > 0">
|
||||
@@ -137,8 +134,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Create Client Form -->
|
||||
<form role="form" aria-label="form">
|
||||
<!-- Name -->
|
||||
<div class="form-group row">
|
||||
@@ -158,9 +153,7 @@
|
||||
|
||||
<!-- Redirect URIs -->
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 col-form-label">{{
|
||||
__('firefly.profile_oauth_redirect_url')
|
||||
}}</label>
|
||||
<label class="col-md-3 col-form-label">{{__('firefly.profile_oauth_redirect_url')}}</label>
|
||||
|
||||
<div class="col-md-9">
|
||||
<input x-model="createForm.redirect_uris" class="form-control"
|
||||
@@ -175,36 +168,24 @@
|
||||
|
||||
<!-- Confidential -->
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 col-form-label">{{
|
||||
__('firefly.profile_oauth_confidential')
|
||||
}}</label>
|
||||
|
||||
<label class="col-md-3 col-form-label">{{ __('firefly.profile_oauth_confidential') }}</label>
|
||||
<div class="col-md-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input x-model="createForm.confidential"
|
||||
type="checkbox">
|
||||
<input x-model="createForm.confidential" type="checkbox">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<span class="form-text text-muted">
|
||||
{{ __('firefly.profile_oauth_confidential_help') }}
|
||||
</span>
|
||||
<span class="form-text text-muted">{{ __('firefly.profile_oauth_confidential_help') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Modal Actions -->
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" data-bs-dismiss="modal" type="button">{{
|
||||
__('firefly.close')
|
||||
}}
|
||||
</button>
|
||||
|
||||
<button class="btn btn-primary" type="button" @click="store">
|
||||
{{ __('firefly.profile_create') }}
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button>
|
||||
<button type="button" class="btn btn-primary" @click="store">{{ __('firefly.profile_create') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user