Skip to content

Commit e0c2e6e

Browse files
committed
close #20
1 parent 89a16f5 commit e0c2e6e

File tree

4 files changed

+49
-4
lines changed

4 files changed

+49
-4
lines changed

src/common/coderbot.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class CoderBot {
174174
data.ctrlTurnElapse = remoteConfig.ctrl_tr_elapse;
175175
data.ctrlTurnSpeed = remoteConfig.ctrl_tr_speed;
176176
data.audioLevel = remoteConfig.audio_volume_level;
177+
data.adminPassword = remoteConfig.admin_password;
177178
this.$store.commit('setSettings', data);
178179
}
179180

@@ -214,6 +215,7 @@ class CoderBot {
214215
ctrl_tr_elapse: settings.ctrlTurnElapse,
215216
ctrl_tr_speed: settings.ctrlTurnSpeed,
216217
audio_volume_level: settings.audioLevel,
218+
admin_password: settings.adminPassword,
217219
});
218220
this.$store.commit('setSettings', settings);
219221
return this.$axios.post(`${this.CBv1}/config`, legacySettings);

src/components/Settings.vue

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
</v-dialog>
113113
</div>
114114
</v-card>
115-
<br>
116115
<h3 class="text-xs-left"> {{ $t('message.settings_actions_update_title') }} </h3>
117116
<v-card>
118117
<div class="cardContent">
@@ -133,7 +132,17 @@
133132
</template>
134133
</div>
135134
</v-card>
135+
<br/><br/>
136136
<br><br>
137+
<h3 class="text-xs-left">{{ $t('message.settings_admin_password_title') }}</h3>
138+
<v-card>
139+
<div class="cardContent">
140+
<v-text-field v-model="settings.adminPassword"
141+
v-bind:label="$t('message.settings_admin_password')"
142+
@input="$v.settings.motorMode.$touch"
143+
/>
144+
</div>
145+
</v-card>
137146
</v-flex>
138147
</v-layout>
139148
</v-container>
@@ -621,6 +630,26 @@
621630
</v-tab-item>
622631
</v-tabs-items>
623632
</v-main>
633+
<!-- Admin password dialog -->
634+
<v-dialog v-model="adminPassword_dialog" max-width="290" persistent>
635+
<v-card>
636+
<v-card-title class="headline">{{ $t("message.settings_admin_password_verify_title") }}</v-card-title>
637+
<v-card-text>
638+
{{ $t("message.settings_admin_password_verify") }}
639+
<v-text-field v-model="adminPassword"
640+
/>
641+
</v-card-text>
642+
<v-card-actions>
643+
<v-spacer></v-spacer>
644+
<v-btn color="green darken-1" text="text" @click="adminPassword_dialog=false; $router.go(-1);">
645+
{{ $t("message.cancel") }}
646+
</v-btn>
647+
<v-btn color="green darken-1" text="text" @click="checkAdminPassword()">
648+
{{ $t("message.ok") }}
649+
</v-btn>
650+
</v-card-actions>
651+
</v-card>
652+
</v-dialog>
624653
<!-- Confirm exit dialog -->
625654
<v-dialog v-model="confirm_exit_dialog" max-width="290">
626655
<v-card>
@@ -672,6 +701,7 @@ export default {
672701
this.settings.cnnModels = this.$store.getters.cnnModels;
673702
this.cb.info = this.$store.getters.info;
674703
this.cb.status = this.$store.getters.status;
704+
this.adminPassword_dialog = this.settings.adminPassword != null && this.settings.adminPassword != '';
675705
},
676706
beforeRouteLeave(to, from, next) {
677707
if (this.$v.$anyDirty) {
@@ -911,6 +941,11 @@ export default {
911941
startupProgram: true,
912942
progLevel: false
913943
};
944+
},
945+
checkAdminPassword() {
946+
if (this.settings.adminPassword == this.adminPassword) {
947+
this.adminPassword_dialog = false;
948+
}
914949
}
915950
},
916951
data() {
@@ -969,6 +1004,7 @@ export default {
9691004
shutterSound: null,
9701005
startupProgram: null,
9711006
progLevel: null,
1007+
adminPassword: null,
9721008
},
9731009
cb: {
9741010
logs: {
@@ -1000,6 +1036,8 @@ export default {
10001036
dirty: false,
10011037
confirm_exit_dialog: null,
10021038
router_next: null,
1039+
adminPassword: null,
1040+
adminPassword_dialog: true,
10031041
};
10041042
},
10051043
validations() {
@@ -1129,7 +1167,7 @@ export default {
11291167
}
11301168
},
11311169
};
1132-
}
1170+
},
11331171
};
11341172
</script>
11351173
<style scoped>

src/i18n/locales/it/messages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@
261261
"settings_toolbax_advanced": "Avanzate",
262262
"settings_confirm_exit_text": "Le modifiche apportate andranno perse, comfermi di voler cambiare pagina?",
263263
"settings_restart_needed": "Per rendere effettive le modifiche, riavviare CdoerBot.",
264+
"settings_admin_password_verify_title": "Accesso riservato",
265+
"settings_admin_password_verify": "Inserire la password di amministrazione.",
266+
"settings_admin_password_title": "Password di amministrazione.",
267+
"settings_admin_password": "passoword",
264268
"validation_integer": "Inserire un numero intero (1234)",
265269
"validation_decimal": "Inserire un numero decimale (12.34)",
266270
"validation_integer_positive": "Inserire un numero intero maggiore o uguale a 0",

src/routes/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ const routes = [
4141
}
4242
},
4343
{
44-
name: 'gallery',
44+
name: 'settings',
4545
path: '/settings',
4646
component: settings,
4747
meta: {
4848
title: `CoderBot - ${i18n.t('message.settings')}`,
49-
}
49+
},
5050
},
5151
{
52+
name: 'gallery',
5253
path: '/gallery',
5354
component: gallery,
5455
meta: {

0 commit comments

Comments
 (0)