Client - display client secret after creation
This commit is contained in:
parent
03db8e8cd6
commit
78fe703494
@ -8,9 +8,16 @@
|
|||||||
@cancelAction="updateDisplayModal(false)"
|
@cancelAction="updateDisplayModal(false)"
|
||||||
/>
|
/>
|
||||||
<div v-if="client && client.client_id">
|
<div v-if="client && client.client_id">
|
||||||
|
<div class="info-box success-message" v-if="afterCreation">
|
||||||
|
{{ $t('oauth2.APP_CREATED_SUCCESSFULLY') }}
|
||||||
|
</div>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>{{ $t('oauth2.APP.CLIENT_ID') }}:</dt>
|
<dt>{{ $t('oauth2.APP.CLIENT_ID') }}:</dt>
|
||||||
<dd>{{ client.client_id }}</dd>
|
<dd>{{ client.client_id }}</dd>
|
||||||
|
<dt v-if="afterCreation && client.client_secret">
|
||||||
|
{{ $t('oauth2.APP.CLIENT_SECRET') }}:
|
||||||
|
</dt>
|
||||||
|
<dd>{{ client.client_secret }}</dd>
|
||||||
<dt>{{ capitalize($t('oauth2.APP.ISSUE_AT')) }}:</dt>
|
<dt>{{ capitalize($t('oauth2.APP.ISSUE_AT')) }}:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{{
|
{{
|
||||||
@ -68,6 +75,7 @@
|
|||||||
toRefs,
|
toRefs,
|
||||||
ref,
|
ref,
|
||||||
onUnmounted,
|
onUnmounted,
|
||||||
|
withDefaults,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
@ -79,13 +87,15 @@
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
authUser: IAuthUserProfile
|
authUser: IAuthUserProfile
|
||||||
|
afterCreation?: boolean
|
||||||
}
|
}
|
||||||
const props = defineProps<Props>()
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
afterCreation: false,
|
||||||
|
})
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const { authUser } = toRefs(props)
|
const { afterCreation, authUser } = toRefs(props)
|
||||||
const client: ComputedRef<IOAuth2Client> = computed(
|
const client: ComputedRef<IOAuth2Client> = computed(
|
||||||
() => store.getters[OAUTH2_STORE.GETTERS.CLIENT]
|
() => store.getters[OAUTH2_STORE.GETTERS.CLIENT]
|
||||||
)
|
)
|
||||||
@ -96,11 +106,13 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
function loadClient() {
|
function loadClient() {
|
||||||
if (route.params.clientId && typeof route.params.clientId === 'string') {
|
// after creation, client is already in store
|
||||||
store.dispatch(
|
if (
|
||||||
OAUTH2_STORE.ACTIONS.GET_CLIENT_BY_ID,
|
!afterCreation.value &&
|
||||||
+route.params.clientId
|
route.params.id &&
|
||||||
)
|
typeof route.params.id === 'string'
|
||||||
|
) {
|
||||||
|
store.dispatch(OAUTH2_STORE.ACTIONS.GET_CLIENT_BY_ID, +route.params.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function deleteClient(clientId: number) {
|
function deleteClient(clientId: number) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<p class="apps-list">{{ $t('oauth2.APPS_LIST') }}</p>
|
<p class="apps-list">{{ $t('oauth2.APPS_LIST') }}</p>
|
||||||
<ul v-if="clients.length > 0">
|
<ul v-if="clients.length > 0">
|
||||||
<li v-for="client in clients" :key="client.client_id">
|
<li v-for="client in clients" :key="client.client_id">
|
||||||
<router-link :to="{ name: 'UserApp', params: { clientId: client.id } }">
|
<router-link :to="{ name: 'UserApp', params: { id: client.id } }">
|
||||||
{{ client.name }}
|
{{ client.name }}
|
||||||
</router-link>
|
</router-link>
|
||||||
<span class="app-issued-at">
|
<span class="app-issued-at">
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"ADD_A_NEW_APP": "Add a new OAuth2 application",
|
"ADD_A_NEW_APP": "Add a new OAuth2 application",
|
||||||
"APP": {
|
"APP": {
|
||||||
"CLIENT_ID": "Client ID",
|
"CLIENT_ID": "Id",
|
||||||
|
"CLIENT_SECRET": "Secret",
|
||||||
"DESCRIPTION": "Application description",
|
"DESCRIPTION": "Application description",
|
||||||
"ISSUE_AT": "issue at",
|
"ISSUE_AT": "issue at",
|
||||||
"NAME": "Application name",
|
"NAME": "Application name",
|
||||||
@ -14,6 +15,7 @@
|
|||||||
"URL": "Application URI"
|
"URL": "Application URI"
|
||||||
},
|
},
|
||||||
"APP_DELETION_CONFIRMATION": "Are you sure you want to delete this app?",
|
"APP_DELETION_CONFIRMATION": "Are you sure you want to delete this app?",
|
||||||
|
"APP_CREATED_SUCCESSFULLY": "Application created successfully. Make sure to copy the secret now, it won't show up again.",
|
||||||
"APPS_LIST": "OAuth2 applications",
|
"APPS_LIST": "OAuth2 applications",
|
||||||
"DELETE_APP": "Delete application",
|
"DELETE_APP": "Delete application",
|
||||||
"NEW_APP": "New OAuth App",
|
"NEW_APP": "New OAuth App",
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"ADD_A_NEW_APP": "Ajouter une nouvelle application OAuth2",
|
"ADD_A_NEW_APP": "Ajouter une nouvelle application OAuth2",
|
||||||
"APP": {
|
"APP": {
|
||||||
"CLIENT_ID": "Identifiant client",
|
"CLIENT_ID": "Identifiant",
|
||||||
|
"CLIENT_SECRET": "Secret",
|
||||||
"DESCRIPTION": "Application description",
|
"DESCRIPTION": "Application description",
|
||||||
"ISSUE_AT": "créée le",
|
"ISSUE_AT": "créée le",
|
||||||
"NAME": "Nom de l'application",
|
"NAME": "Nom de l'application",
|
||||||
@ -14,6 +15,7 @@
|
|||||||
"URL": "URL de l'application"
|
"URL": "URL de l'application"
|
||||||
},
|
},
|
||||||
"APP_DELETION_CONFIRMATION": "Êtes-vous sûr de vouloir supprimer cette application ?",
|
"APP_DELETION_CONFIRMATION": "Êtes-vous sûr de vouloir supprimer cette application ?",
|
||||||
|
"APP_CREATED_SUCCESSFULLY": "Application créée avec succès. Assurez-vous de copier le secret maintenant, il ne s'affichera plus.",
|
||||||
"APPS_LIST": "Applications OAuth2",
|
"APPS_LIST": "Applications OAuth2",
|
||||||
"DELETE_APP": "Supprimer l'application",
|
"DELETE_APP": "Supprimer l'application",
|
||||||
"NEW_APP": "Ajouter une App OAuth",
|
"NEW_APP": "Ajouter une App OAuth",
|
||||||
|
@ -159,10 +159,16 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
component: UserAppsList,
|
component: UserAppsList,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':clientId',
|
path: ':id',
|
||||||
name: 'UserApp',
|
name: 'UserApp',
|
||||||
component: UserApp,
|
component: UserApp,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: ':id/created',
|
||||||
|
name: 'CreatedUserApp',
|
||||||
|
component: UserApp,
|
||||||
|
props: { afterCreation: true },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'new',
|
path: 'new',
|
||||||
name: 'AddUserApp',
|
name: 'AddUserApp',
|
||||||
|
@ -18,9 +18,11 @@ export const actions: ActionTree<IOAuth2State, IRootState> & IOAuth2Actions = {
|
|||||||
.post('oauth/apps', payload)
|
.post('oauth/apps', payload)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.status === 'created') {
|
if (res.data.status === 'created') {
|
||||||
context
|
context.commit(
|
||||||
.dispatch(OAUTH2_STORE.ACTIONS.GET_CLIENTS)
|
OAUTH2_STORE.MUTATIONS.SET_CLIENT,
|
||||||
.then(() => router.push('/profile/apps'))
|
res.data.data.client
|
||||||
|
)
|
||||||
|
router.push(`/profile/apps/${res.data.data.client.id}/created`)
|
||||||
} else {
|
} else {
|
||||||
handleError(context, null)
|
handleError(context, null)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user