Api key setting
This commit is contained in:
		
							parent
							
								
									87451b1223
								
							
						
					
					
						commit
						c00ab0fbe2
					
				
					 4 changed files with 51 additions and 0 deletions
				
			
		
							
								
								
									
										46
									
								
								src/client/pages/settings/api.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/client/pages/settings/api.vue
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,46 @@
 | 
			
		|||
<template>
 | 
			
		||||
<section class="_card">
 | 
			
		||||
	<div class="_title"><fa :icon="faKey"/> API</div>
 | 
			
		||||
	<div class="_content">
 | 
			
		||||
		<mk-input :value="$store.state.i.token" readonly>
 | 
			
		||||
			<span>{{ $t('token') }}</span>
 | 
			
		||||
		</mk-input>
 | 
			
		||||
		<mk-button @click="regenerateToken"><fa :icon="faSyncAlt"/> {{ $t('regenerate') }}</mk-button>
 | 
			
		||||
	</div>
 | 
			
		||||
</section>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script lang="ts">
 | 
			
		||||
import Vue from 'vue';
 | 
			
		||||
import { faKey, faSyncAlt } from '@fortawesome/free-solid-svg-icons';
 | 
			
		||||
import i18n from '../../i18n';
 | 
			
		||||
import MkButton from '../../components/ui/button.vue';
 | 
			
		||||
import MkInput from '../../components/ui/input.vue';
 | 
			
		||||
 | 
			
		||||
export default Vue.extend({
 | 
			
		||||
	i18n,
 | 
			
		||||
	components: {
 | 
			
		||||
		MkButton, MkInput
 | 
			
		||||
	},
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			faKey, faSyncAlt
 | 
			
		||||
		};
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		regenerateToken() {
 | 
			
		||||
			this.$root.dialog({
 | 
			
		||||
				title: this.$t('password'),
 | 
			
		||||
				input: {
 | 
			
		||||
					type: 'password'
 | 
			
		||||
				}
 | 
			
		||||
			}).then(({ canceled, result: password }) => {
 | 
			
		||||
				if (canceled) return;
 | 
			
		||||
				this.$root.api('i/regenerate_token', {
 | 
			
		||||
					password: password
 | 
			
		||||
				});
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
});
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +14,7 @@
 | 
			
		|||
	<x-security/>
 | 
			
		||||
	<x-2fa/>
 | 
			
		||||
	<x-integration/>
 | 
			
		||||
	<x-api/>
 | 
			
		||||
 | 
			
		||||
	<mk-button @click="cacheClear()" primary class="cacheClear">{{ $t('cacheClear') }}</mk-button>
 | 
			
		||||
	<mk-button @click="$root.signout()" primary class="logout">{{ $t('logout') }}</mk-button>
 | 
			
		||||
| 
						 | 
				
			
			@ -34,6 +35,7 @@ import XSecurity from './security.vue';
 | 
			
		|||
import XTheme from './theme.vue';
 | 
			
		||||
import X2fa from './2fa.vue';
 | 
			
		||||
import XIntegration from './integration.vue';
 | 
			
		||||
import XApi from './api.vue';
 | 
			
		||||
import MkButton from '../../components/ui/button.vue';
 | 
			
		||||
 | 
			
		||||
export default Vue.extend({
 | 
			
		||||
| 
						 | 
				
			
			@ -55,6 +57,7 @@ export default Vue.extend({
 | 
			
		|||
		XTheme,
 | 
			
		||||
		X2fa,
 | 
			
		||||
		XIntegration,
 | 
			
		||||
		XApi,
 | 
			
		||||
		MkButton,
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue