diff --git a/frontend/src/pages/FlowChart.vue b/frontend/src/pages/FlowChart.vue
index 8064ac6..2ab73d0 100644
--- a/frontend/src/pages/FlowChart.vue
+++ b/frontend/src/pages/FlowChart.vue
@@ -232,8 +232,38 @@ const onDeploy = async () => {
});
return;
}
+
+ deployLoading.value = true;
+ try {
+ const { data }: {data: {code: string, groups: {code: string}[]}} = await api.get('api/v1/defaultgroup');
+ if (data.code === 'CB_WA01') {
+ $q.notify({
+ type: 'negative',
+ caption: 'エラー',
+ message: 'ユーザーのパスワード認証に失敗しました。'
+ });
+ deployLoading.value = false;
+ return;
+ } else if (!data.groups || !data.groups.some((group: {code: string}) => group.code === 'Administrators')){
+ $q.notify({
+ type: 'negative',
+ caption: 'エラー',
+ message: 'この操作には管理者権限が必要です。'
+ });
+ deployLoading.value = false;
+ return;
+ }
+ } catch (e) {
+ $q.notify({
+ type: 'negative',
+ caption: 'エラー',
+ message: 'サーバーに接続できませんでした。'
+ });
+ deployLoading.value = false;
+ return;
+ }
+
try {
- deployLoading.value = true;
await store.deploy();
deployLoading.value = false;
$q.notify({
diff --git a/frontend/src/pages/TenantDomain.vue b/frontend/src/pages/TenantDomain.vue
index fb6228f..07317ae 100644
--- a/frontend/src/pages/TenantDomain.vue
+++ b/frontend/src/pages/TenantDomain.vue
@@ -53,21 +53,21 @@
Kintone Account
-
+
-
-
+ hint="Kintoneのパスワードを入力してください" label="パスワード" :disable="!isCreate" lazy-rules
+ :rules="[val => val && val.length > 0 || 'Kintoneのパスワードを入力してください']" autocomplete="new-password">
@@ -88,30 +88,51 @@
- パスワードリセット
+ 管理者アカウントの変更
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+ {{ testResult?.msg }}
+
+
+
+
+
+
+
+
+
@@ -187,12 +208,14 @@ const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
const loading = ref(false);
const addEditLoading = ref(false);
const deleteLoadingState = ref(-1); // -2: deleteLoading, -1: loading, 0: allow, > 0: user count
+const connectLoading = ref(null);
const filter = ref('');
const rows = ref([]);
const show = ref(false);
const confirm = ref(false);
-const resetPsw = ref(false);
+const changeAccount = ref(false);
+const testResult = ref<{msg: string, success?: boolean}|null>(null);
const currentDomainId = computed(() => authStore.currentDomain.id);
// const tenantid = ref(authStore.currentDomain.id);
@@ -200,8 +223,8 @@ const name = ref('');
const url = ref('');
const isPwd = ref(true);
const kintoneuser = ref('');
+const kintoneuserBK = ref('');
const kintonepwd = ref('');
-const kintonepwdBK = ref('');
const domainActive = ref(true);
const isCreate = ref(true);
let editId = ref(0);
@@ -316,19 +339,20 @@ function editRow(row: any) {
name.value = row.name;
url.value = row.url;
kintoneuser.value = row.user;
- kintonepwd.value = row.password;
+ kintoneuserBK.value = row.user;
+ kintonepwd.value = ''
domainActive.value = row.domainActive;
isPwd.value = true;
show.value = true;
};
-const updateResetPsw = (value: boolean) => {
- if (value === true) {
- kintonepwd.value = ''
- isPwd.value = true
- } else {
- kintonepwd.value = kintonepwdBK.value
- }
+const updateChangeAccount = () => {
+ kintoneuser.value = kintoneuserBK.value;
+ kintonepwd.value = ''
+ connectLoading.value = null
+ isPwd.value = true
+ stopConnect();
+ testResult.value = null;
}
const closeDg = () => {
@@ -336,8 +360,60 @@ const closeDg = () => {
onReset();
}
-const onSubmit = () => {
+const tryConnect = async (isTest = true) => {
+ testResult.value = null;
+ if (isTest) {
+ connectLoading.value = new AbortController();
+ }
+ try {
+ const { data }: {data: {code: string, groups: {code: string}[]}} = await api.get('api/v1/group', {
+ params:{
+ kintoneurl: ensureHttps(url.value),
+ kintoneuser: kintoneuser.value,
+ kintonepwd: kintonepwd.value,
+ },
+ signal: (isTest && connectLoading.value) ? connectLoading.value.signal : undefined
+ });
+ if (data.code === 'CB_WA01') {
+ testResult.value = { msg: 'ユーザーのパスワード認証に失敗しました。' }
+ } else if (data.groups && data.groups.some((group: {code: string}) => group.code === 'Administrators')){
+ testResult.value = { success: true, msg: isTest ? 'kintoneの管理者アカウントで接続に成功しました。' : '' }
+ return true;
+ } else {
+ testResult.value = { msg: 'このアカウントはkintoneの管理者アカウントではありません。' }
+ }
+ return false;
+ } catch (e) {
+ const error = e as { code?: string };
+ if (error.code === 'ERR_CANCELED') {
+ console.log('Aborted');
+ } else {
+ testResult.value = { msg: 'サーバーに接続できませんでした。' }
+ throw error;
+ }
+ return false;
+ } finally {
+ connectLoading.value = null;
+ }
+}
+
+const ensureHttps = (url: string) => {
+ return !/^https?:\/\//i.test(url) ? 'https://' + url : url;
+}
+
+const stopConnect = () => {
+ if (!connectLoading.value) return;
+ connectLoading.value?.abort();
+ connectLoading.value = null;
+}
+
+const onSubmit = async () => {
addEditLoading.value = true;
+ const tryResult = await tryConnect(false);
+ if (!tryResult) {
+ addEditLoading.value = false;
+ return
+ };
const method = editId.value !== 0 ? 'put' : 'post';
const param: IDomainSubmit = {
'id': editId.value,
@@ -345,7 +421,7 @@ const onSubmit = () => {
'name': name.value,
'url': url.value,
'kintoneuser': kintoneuser.value,
- 'kintonepwd': ((isCreate.value && editId.value == 0) || resetPsw.value) ? kintonepwd.value : '',
+ 'kintonepwd': ((isCreate.value && editId.value == 0) || changeAccount.value) ? kintonepwd.value : '',
'is_active': domainActive.value,
'ownerid': authStore.userId || ''
}
@@ -374,17 +450,24 @@ function openShareDg(type: typeof SHARE_MANAGE|typeof SHARE_USE, row: IDomainOwn
}
};
+const isConnectable = computed(()=> {
+ return url.value && kintoneuser.value && kintonepwd.value
+})
+
const onReset = () => {
name.value = '';
url.value = '';
kintoneuser.value = '';
+ kintoneuserBK.value = '';
kintonepwd.value = '';
isPwd.value = true;
editId.value = 0;
isCreate.value = true;
domainActive.value = true;
- resetPsw.value = false
+ changeAccount.value = false;
addEditLoading.value = false;
+ connectLoading.value = null
+ testResult.value = null;
}