mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-28 03:10:29 +00:00
parent
1f9d943564
commit
02913fa7b6
3 changed files with 15 additions and 2 deletions
|
@ -432,6 +432,7 @@
|
|||
"api_usage": "Example API Usage",
|
||||
"cli_usage": "Example CLI Usage",
|
||||
"dl_cli": "Download CLI",
|
||||
"shell_setup_before": "do shell setup steps before"
|
||||
"shell_setup_before": "do shell setup steps before",
|
||||
"reset_token": "Reset token"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,6 +289,10 @@ export default class WoodpeckerClient extends ApiClient {
|
|||
return this._delete(`/api/users/${user.login}`);
|
||||
}
|
||||
|
||||
resetToken(): Promise<string> {
|
||||
return this._delete('/api/user/token') as Promise<string>;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line promise/prefer-await-to-callbacks
|
||||
on(callback: (data: { pipeline?: Pipeline; repo?: Repo; step?: PipelineStep }) => void): EventSource {
|
||||
return this._subscribe('/stream/events', callback, {
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
<SelectField v-model="selectedLocale" :options="localeOptions" />
|
||||
|
||||
<div>
|
||||
<h2 class="text-lg text-color">{{ $t('user.token') }}</h2>
|
||||
<div class="flex items-center mb-2">
|
||||
<h2 class="text-lg text-color">{{ $t('user.token') }}</h2>
|
||||
<Button class="ml-4" :text="$t('user.reset_token')" @click="resetToken" />
|
||||
</div>
|
||||
<pre class="cli-box">{{ token }}</pre>
|
||||
</div>
|
||||
|
||||
|
@ -90,6 +93,11 @@ const selectedLocale = computed<string>({
|
|||
return storedLocale.value;
|
||||
},
|
||||
});
|
||||
|
||||
const resetToken = async () => {
|
||||
token.value = await apiClient.resetToken();
|
||||
window.location.href = `${address}/logout`;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in a new issue