Display unhashed client secret
This commit is contained in:
parent
515b502364
commit
eece534f1d
|
@ -7,6 +7,7 @@ import axios from 'axios'
|
||||||
import ApplicationForm from '~/components/auth/ApplicationForm.vue'
|
import ApplicationForm from '~/components/auth/ApplicationForm.vue'
|
||||||
|
|
||||||
import useErrorHandler from '~/composables/useErrorHandler'
|
import useErrorHandler from '~/composables/useErrorHandler'
|
||||||
|
import { useStore } from '~/store'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id: number
|
id: number
|
||||||
|
@ -50,6 +51,10 @@ const refreshToken = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchApplication()
|
fetchApplication()
|
||||||
|
|
||||||
|
const store = useStore()
|
||||||
|
const secret = store.state.auth.applicationSecret
|
||||||
|
store.state.auth.applicationSecret = undefined
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -89,11 +94,27 @@ fetchApplication()
|
||||||
:value="application.client_id"
|
:value="application.client_id"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div
|
||||||
|
v-if="secret"
|
||||||
|
class="field"
|
||||||
|
>
|
||||||
|
<div class="ui small warning message">
|
||||||
|
<h3 class="header">
|
||||||
|
<translate translate-context="*/*/*">
|
||||||
|
Please, note this token
|
||||||
|
</translate>
|
||||||
|
</h3>
|
||||||
|
<p>
|
||||||
|
<translate translate-context="*/*/*">
|
||||||
|
It won't be possible to view it again.
|
||||||
|
</translate>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label for="copy-secret"><translate translate-context="Content/Applications/Label">Application secret</translate></label>
|
<label for="copy-secret"><translate translate-context="Content/Applications/Label">Application secret</translate></label>
|
||||||
<copy-input
|
<copy-input
|
||||||
id="copy-secret"
|
id="copy-secret"
|
||||||
:value="application.client_secret"
|
:value="secret"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
import ApplicationForm from '~/components/auth/ApplicationForm.vue'
|
import ApplicationForm from '~/components/auth/ApplicationForm.vue'
|
||||||
import { computed, reactive } from 'vue'
|
import { computed, reactive } from 'vue'
|
||||||
import { useGettext } from 'vue3-gettext'
|
import { useGettext } from 'vue3-gettext'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import type { Application } from '~/types'
|
||||||
|
import { useStore } from '~/store'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
name?: string
|
name?: string
|
||||||
|
@ -25,6 +28,20 @@ const { $pgettext } = useGettext()
|
||||||
const labels = computed(() => ({
|
const labels = computed(() => ({
|
||||||
title: $pgettext('Content/Settings/Button.Label', 'Create a new application')
|
title: $pgettext('Content/Settings/Button.Label', 'Create a new application')
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const store = useStore()
|
||||||
|
|
||||||
|
const created = (application: Application) => {
|
||||||
|
store.state.auth.applicationSecret = application.client_secret
|
||||||
|
console.log(application)
|
||||||
|
return router.push({
|
||||||
|
name: 'settings.applications.edit',
|
||||||
|
params: {
|
||||||
|
id: application.client_id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -46,7 +63,7 @@ const labels = computed(() => ({
|
||||||
</h2>
|
</h2>
|
||||||
<application-form
|
<application-form
|
||||||
:defaults="defaults"
|
:defaults="defaults"
|
||||||
@created="$router.push({name: 'settings.applications.edit', params: {id: $event.client_id}})"
|
@created="created"
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,6 +16,8 @@ export interface State {
|
||||||
profile: null | User
|
profile: null | User
|
||||||
oauth: OAuthTokens
|
oauth: OAuthTokens
|
||||||
scopedTokens: ScopedTokens
|
scopedTokens: ScopedTokens
|
||||||
|
|
||||||
|
applicationSecret: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ScopedTokens {
|
interface ScopedTokens {
|
||||||
|
@ -71,7 +73,9 @@ const store: Module<State, RootState> = {
|
||||||
},
|
},
|
||||||
profile: null,
|
profile: null,
|
||||||
oauth: getDefaultOauth(),
|
oauth: getDefaultOauth(),
|
||||||
scopedTokens: getDefaultScopedTokens()
|
scopedTokens: getDefaultScopedTokens(),
|
||||||
|
|
||||||
|
applicationSecret: undefined
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
header: state => {
|
header: state => {
|
||||||
|
@ -93,6 +97,8 @@ const store: Module<State, RootState> = {
|
||||||
library: false,
|
library: false,
|
||||||
moderation: false
|
moderation: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.applicationSecret = undefined
|
||||||
},
|
},
|
||||||
profile: (state, value) => {
|
profile: (state, value) => {
|
||||||
state.profile = value
|
state.profile = value
|
||||||
|
|
|
@ -496,6 +496,7 @@ export interface Application {
|
||||||
name: string
|
name: string
|
||||||
redirect_uris: string
|
redirect_uris: string
|
||||||
scopes: string
|
scopes: string
|
||||||
|
client_secret: string
|
||||||
|
|
||||||
// This is actually a date string
|
// This is actually a date string
|
||||||
created: string
|
created: string
|
||||||
|
|
Loading…
Reference in New Issue