fix: personal access tokens failed with a 500 in production
Passport needs a "personal access client" to issue personal access tokens, and only the seeder created it (production runs migrations, not the seeder), so createToken threw "Personal access client not found". - New idempotent command passport:ensure-personal-client, run by the container entrypoint after the migrations. - The tokens page now shows an error when the server fails instead of doing nothing (es, en, ca). - Tests: the command creates the client once; tokens can be created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ const ca: MessageSchema = {
|
||||
edit: 'Editar',
|
||||
delete: 'Esborrar',
|
||||
none: '(cap)',
|
||||
unexpectedError: "Alguna cosa ha fallat. Torna-ho a provar d'aquí a una estona.",
|
||||
},
|
||||
login: {
|
||||
title: 'Entrar',
|
||||
|
||||
@@ -23,6 +23,7 @@ const en: MessageSchema = {
|
||||
edit: 'Edit',
|
||||
delete: 'Delete',
|
||||
none: '(none)',
|
||||
unexpectedError: 'Something went wrong. Please try again in a moment.',
|
||||
},
|
||||
login: {
|
||||
title: 'Sign in',
|
||||
|
||||
@@ -21,6 +21,7 @@ const es = {
|
||||
edit: 'Editar',
|
||||
delete: 'Borrar',
|
||||
none: '(ninguno)',
|
||||
unexpectedError: 'Algo salió mal. Probá de nuevo en un momento.',
|
||||
},
|
||||
login: {
|
||||
title: 'Ingresar',
|
||||
|
||||
@@ -14,6 +14,7 @@ const newToken = ref<string | null>(null);
|
||||
|
||||
const form = reactive<{ name: string; scopes: string[] }>({ name: '', scopes: [] });
|
||||
const errors = ref<Record<string, string[]>>({});
|
||||
const failed = ref(false);
|
||||
|
||||
async function load(): Promise<void> {
|
||||
loading.value = true;
|
||||
@@ -29,6 +30,7 @@ async function load(): Promise<void> {
|
||||
async function create(): Promise<void> {
|
||||
creating.value = true;
|
||||
errors.value = {};
|
||||
failed.value = false;
|
||||
newToken.value = null;
|
||||
|
||||
try {
|
||||
@@ -39,6 +41,8 @@ async function create(): Promise<void> {
|
||||
await load();
|
||||
} catch (e: any) {
|
||||
errors.value = e.response?.data?.errors ?? {};
|
||||
// Sin errores de validación (p. ej. un 500): avisar en vez de no hacer nada.
|
||||
failed.value = !e.response?.data?.errors;
|
||||
} finally {
|
||||
creating.value = false;
|
||||
}
|
||||
@@ -84,6 +88,8 @@ onMounted(load);
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="failed" class="field__error">{{ t('common.unexpectedError') }}</p>
|
||||
|
||||
<div>
|
||||
<button type="submit" :disabled="creating" class="btn btn--primary">
|
||||
{{ creating ? t('common.creating') : t('tokens.create') }}
|
||||
|
||||
Reference in New Issue
Block a user