mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Drop 'change admin password' view, now part of the global setting panel
This commit is contained in:
parent
ce1247e001
commit
5b3f6900b0
5 changed files with 1 additions and 84 deletions
|
@ -137,7 +137,7 @@ export function formatYunoHostArgument (arg) {
|
|||
props: defaultProps.concat(['type', 'autocomplete', 'trim']),
|
||||
callback: function () {
|
||||
if (!arg.help) {
|
||||
arg.help = 'good_practices_about_admin_password'
|
||||
arg.help = i18n.t('good_practices_about_admin_password')
|
||||
}
|
||||
arg.example = '••••••••••••'
|
||||
validation.passwordLenght = validators.minLength(8)
|
||||
|
|
|
@ -378,7 +378,6 @@
|
|||
"restart": "Restart",
|
||||
"retry": "Retry",
|
||||
"human_routes": {
|
||||
"adminpw": "Change admin password",
|
||||
"apps": {
|
||||
"action_config": "Run action '{action}' of app '{name}' configuration",
|
||||
"change_label": "Change label of '{prevName}' for '{nextName}'",
|
||||
|
@ -487,9 +486,6 @@
|
|||
"text_selection_is_disabled": "Text selection is disabled. If you want to share this log, please share the *full* log with the 'Share with Yunopaste' button.<br/><small>Or if you really really want to select text, press these keys: ↓↓↑↑.</small>",
|
||||
"tip_about_user_email": "Users are created with an associated email address (and XMPP account) with the format username@domain.tld. Additional email aliases and email forwards can later be added by the admin and the user.",
|
||||
"tools": "Tools",
|
||||
"tools_adminpw": "Change administration password",
|
||||
"tools_adminpw_current": "Current password",
|
||||
"tools_adminpw_current_placeholder": "Enter your current password",
|
||||
"tools_reboot": "Reboot your server",
|
||||
"tools_reboot_btn": "Reboot",
|
||||
"tools_shutdown": "Shutdown your server",
|
||||
|
|
|
@ -346,15 +346,6 @@ const routes = [
|
|||
breadcrumb: ['tool-list', 'tool-firewall']
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'tool-adminpw',
|
||||
path: '/tools/adminpw',
|
||||
component: () => import(/* webpackChunkName: "views/tools/adminpw" */ '@/views/tool/ToolAdminpw'),
|
||||
meta: {
|
||||
args: { trad: 'tools_adminpw' },
|
||||
breadcrumb: ['tool-list', 'tool-adminpw']
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'tool-webadmin',
|
||||
path: '/tools/webadmin',
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
<template>
|
||||
<password-form
|
||||
:title="$t('postinstall_set_password')"
|
||||
:server-error="serverError"
|
||||
@submit="onSubmit"
|
||||
:extra="extra"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/api'
|
||||
import { validationMixin } from 'vuelidate'
|
||||
|
||||
import { PasswordForm } from '@/views/_partials'
|
||||
import { required, minLength } from '@/helpers/validators'
|
||||
|
||||
export default {
|
||||
name: 'ToolAdminpw',
|
||||
|
||||
data () {
|
||||
return {
|
||||
serverError: '',
|
||||
|
||||
extra: {
|
||||
form: {
|
||||
currentPassword: ''
|
||||
},
|
||||
fields: {
|
||||
currentPassword: {
|
||||
label: this.$i18n.t('tools_adminpw_current'),
|
||||
description: this.$i18n.t('tools_adminpw_current_placeholder'),
|
||||
props: { id: 'current-password', type: 'password', placeholder: '••••••••' }
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
currentPassword: { required, passwordLenght: minLength(8) }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onSubmit ({ currentPassword, password }) {
|
||||
this.serverError = ''
|
||||
|
||||
api.fetchAll(
|
||||
[['POST', 'login', { credentials: currentPassword }, null, { websocket: false }],
|
||||
['PUT', 'adminpw', { new_password: password }, 'adminpw']],
|
||||
{ wait: true }
|
||||
).then(() => {
|
||||
this.$store.dispatch('DISCONNECT')
|
||||
}).catch(err => {
|
||||
if (err.name === 'APIUnauthorizedError') {
|
||||
// Prevent automatic disconnect if error in current password.
|
||||
this.serverError = this.$i18n.t('wrong_password')
|
||||
} else if (err.name === 'APIBadRequestError') {
|
||||
// Display form error
|
||||
this.serverError = err.message
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
mixins: [validationMixin],
|
||||
components: { PasswordForm }
|
||||
}
|
||||
</script>
|
|
@ -24,7 +24,6 @@ export default {
|
|||
{ routeName: 'tool-migrations', icon: 'share', translation: 'migrations' },
|
||||
{ routeName: 'service-list', icon: 'gears', translation: 'services' },
|
||||
{ routeName: 'tool-firewall', icon: 'shield', translation: 'firewall' },
|
||||
{ routeName: 'tool-adminpw', icon: 'key-modern', translation: 'tools_adminpw' },
|
||||
{ routeName: 'tool-settings', icon: 'sliders', translation: 'tools_yunohost_settings' },
|
||||
{ routeName: 'tool-webadmin', icon: 'sliders', translation: 'tools_webadmin_settings' },
|
||||
{ routeName: 'tool-power', icon: 'power-off', translation: 'tools_shutdown_reboot' }
|
||||
|
|
Loading…
Reference in a new issue