Преглед на файлове

add sync password functionality. remove mitm operations. alert on change password

pull/9/head
Jonathan Cobb преди 4 години
родител
ревизия
7292e17c46
променени са 6 файла, в които са добавени 31 реда и са изтрити 129 реда
  1. +0
    -17
      src/_services/app.service.js
  2. +0
    -67
      src/_store/apps.module.js
  3. +1
    -1
      src/account/AppsPage.vue
  4. +1
    -40
      src/account/DevicesPage.vue
  5. +22
    -1
      src/account/NewNetworkPage.vue
  6. +7
    -3
      src/account/profile/ChangePasswordPage.vue

+ 0
- 17
src/_services/app.service.js Целия файл

@@ -6,10 +6,6 @@ import config from 'config';
import { util } from '../_helpers';

export const appService = {
getMitmStatus,
enableMitm,
disableMitm,

getAppsByUserId,
getAppByUserId,
getAppAssetByUserId,
@@ -30,19 +26,6 @@ export const appService = {
takeConfigAppAction
};

// MITM
function getMitmStatus(userId, messages, errors) {
return fetch(`${config.apiUrl}/users/${userId}/mitm`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors));
}

function enableMitm(userId, messages, errors) {
return fetch(`${config.apiUrl}/users/${userId}/mitm/enable`, util.postWithAuth()).then(util.handleCrudResponse(messages, errors));
}

function disableMitm(userId, messages, errors) {
return fetch(`${config.apiUrl}/users/${userId}/mitm/disable`, util.postWithAuth()).then(util.handleCrudResponse(messages, errors));
}

// Apps
function getAppsByUserId(userId, messages, errors) {
return fetch(`${config.apiUrl}/users/${userId}/apps`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors));


+ 0
- 67
src/_store/apps.module.js Целия файл

@@ -7,12 +7,10 @@ import { util } from '../_helpers';

const state = {
loading: {
enableMitm: false, disableMitm: false,
apps: false, app: false, enableApp: false, disableApp: false,
sites: false, site: false, enableSite: false, disableSite: false,
appData: false, appConfig: false, action: false
},
mitmEnabled: null,
error: null,
apps: [],
icons: {},
@@ -25,34 +23,6 @@ const state = {
};

const actions = {
// MITM
getMitmStatus({ commit }, {userId, messages, errors}) {
commit('getMitmStatusRequest');
appService.getMitmStatus(userId, messages, errors)
.then(
enabled => commit('getMitmStatusSuccess', enabled),
error => commit('getMitmStatusFailure', error)
);
},

enableMitm({ commit }, {userId, messages, errors}) {
commit('enableMitmRequest');
appService.enableMitm(userId, messages, errors)
.then(
enabled => commit('enableMitmSuccess', enabled),
error => commit('enableMitmFailure', error)
);
},

disableMitm({ commit }, {userId, messages, errors}) {
commit('disableMitmRequest');
appService.disableMitm(userId, messages, errors)
.then(
enabled => commit('disableMitmSuccess', enabled),
error => commit('disableMitmFailure', error)
);
},

// Apps
getAppsByUserId({ commit }, {userId, messages, errors}) {
commit('getAppsByUserIdRequest');
@@ -210,43 +180,6 @@ const actions = {
};

const mutations = {
// MITM
getMitmStatusRequest(state) {
state.loading.getMitmStatus = true;
},
getMitmStatusSuccess(state, enabled) {
state.loading.getMitmStatus = false;
state.mitmEnabled = enabled;
},
getMitmStatusFailure(state, error) {
state.loading.getMitmStatus = false;
state.error = error;
},

enableMitmRequest(state) {
state.loading.enableMitm = true;
},
enableMitmSuccess(state, enabled) {
state.loading.enableMitm = false;
state.mitmEnabled = enabled;
},
enableMitmFailure(state, error) {
state.loading.apps = false;
state.error = error;
},

disableMitmRequest(state) {
state.loading.disableMitm = true;
},
disableMitmSuccess(state, enabled) {
state.loading.disableMitm = false;
state.mitmEnabled = enabled;
},
disableMitmFailure(state, error) {
state.loading.apps = false;
state.error = error;
},

// Apps
getAppsByUserIdRequest(state) {
state.loading.apps = true;


+ 1
- 1
src/account/AppsPage.vue Целия файл

@@ -36,7 +36,7 @@
};
},
computed: {
...mapState('apps', ['mitmEnabled', 'apps', 'app', 'icons']),
...mapState('apps', ['apps', 'app', 'icons']),
...mapState('system', ['messages'])
},
created () {


+ 1
- 40
src/account/DevicesPage.vue Целия файл

@@ -103,15 +103,6 @@
<a href="/api/auth/cacert?deviceType=firefox">{{messages.message_os_firefox}}</a>
<hr/>
</div>

<div v-if="user && user.admin">
<h4>{{messages.form_title_mitm}}: {{mitmEnabled ? messages.message_mitm_enabled : messages.message_mitm_disabled}}</h4>
<button v-if="mitmEnabled" :disabled="mitmLoading" @click="mitmOff()">{{messages.button_label_mitm_disable}}</button>
<button v-else :disabled="mitmLoading" @click="mitmOn()">{{messages.button_label_mitm_enable}}</button>
<div v-if="errors.has('mitm')" class="invalid-feedback d-block">{{ errors.first('mitm') }}</div>
<hr/>
</div>

</div>
</template>

@@ -132,12 +123,10 @@
displayVpnConfig: {},
displayDeviceHelp: {},
config: config,
mitmLoading: true,
loadingImgSrc: loadingImgSrc
};
},
computed: {
...mapState('apps', ['mitmEnabled']),
...mapState('devices', ['deviceTypes', 'devices', 'device', 'qrCodeImageBase64', 'vpnConfBase64']),
...mapState('system', ['messages']),
...mapGetters('devices', ['loading']),
@@ -146,11 +135,6 @@
}
},
created () {
this.getMitmStatus({
userId: this.userId,
messages: this.messages,
errors: this.errors
});
this.getDevicesByUserId({
userId: this.userId,
messages: this.messages,
@@ -171,7 +155,6 @@
});
},
methods: {
...mapActions('apps', ['getMitmStatus', 'enableMitm', 'disableMitm']),
...mapActions('devices', [
'getAllDeviceTypesByUserId', 'getDevicesByUserId', 'addDeviceByUserId', 'removeDeviceByUserId',
'getDeviceQRcodeById', 'getDeviceVPNconfById'
@@ -223,26 +206,7 @@
this.displayDeviceHelp = {};
this.displayDeviceHelp[id] = true;
},
hideDeviceHelp () { this.displayDeviceHelp = {}; },

mitmOn () {
this.mitmLoading = true;
this.errors.clear();
this.enableMitm({
userId: this.user.uuid,
messages: this.messages,
errors: this.errors
});
},
mitmOff () {
this.mitmLoading = true;
this.errors.clear();
this.disableMitm({
userId: this.user.uuid,
messages: this.messages,
errors: this.errors
});
}
hideDeviceHelp () { this.displayDeviceHelp = {}; }
},
watch: {
device(dev) {
@@ -252,9 +216,6 @@
this.deviceType = null;
if (dev.uuid) this.displayDeviceHelp[dev.uuid] = true;
}
},
mitmEnabled (m) {
this.mitmLoading = false;
}
}
};

+ 22
- 1
src/account/NewNetworkPage.vue Целия файл

@@ -208,11 +208,26 @@
<div>{{messages.field_description_network_ssh_key}}</div>
<hr/>

<!-- error and metrics reporting -->
<!-- sync password -->
<div class="form-group">
<label for="syncPassword">{{messages.field_label_sync_password}}</label>
<input type="checkbox" id="syncPassword" v-model="accountPlan.syncPassword">
<div v-if="submitted && errors.has('syncPassword')" class="invalid-feedback d-block">{{ errors.first('syncPassword') }}</div>
<p>{{messages.field_label_sync_password_description}}</p>
</div>
<!-- error reporting -->
<div class="form-group" v-if="configs.requireSendMetrics && configs.requireSendMetrics !== true">
<label for="sendErrors">{{messages.field_label_send_errors}}</label>
<input type="checkbox" id="sendErrors" v-model="accountPlan.sendErrors">
<div v-if="submitted && errors.has('sendErrors')" class="invalid-feedback d-block">{{ errors.first('sendErrors') }}</div>
<p>{{messages.field_label_send_errors_description}}</p>
</div>
<!-- metrics reporting -->
<div class="form-group" v-if="configs.requireSendMetrics && configs.requireSendMetrics !== true">
<label for="sendMetrics">{{messages.field_label_send_metrics}}</label>
<input type="checkbox" id="sendMetrics" v-model="accountPlan.sendMetrics">
<div v-if="submitted && errors.has('sendMetrics')" class="invalid-feedback d-block">{{ errors.first('sendMetrics') }}</div>
<p>{{messages.field_label_send_metrics_description}}</p>
</div>
<hr/>

@@ -336,6 +351,8 @@
},
sshKey: '',
forkHost: '',
syncPassword: true,
sendErrors: true,
sendMetrics: true
},
networkType: 'bubble',
@@ -602,7 +619,11 @@
this.errors.add({field: 'region', msg: this.messages['err_region_notFound']});
} else {
if (this.configs.requireSendMetrics) {
this.accountPlan.sendErrors = true;
this.accountPlan.sendMetrics = true;
} else {
if (this.accountPlan.sendErrors === null) this.accountPlan.sendErrors = true;
if (this.accountPlan.sendMetrics === null) this.accountPlan.sendMetrics = true;
}
this.addPlanAndStartNetwork({
userId: this.user.uuid,


+ 7
- 3
src/account/profile/ChangePasswordPage.vue Целия файл

@@ -85,6 +85,7 @@
...mapState('system', ['messages'])
},
methods: {
...mapActions({ alertSuccess: 'alert/success', alertError: 'alert/error' }),
...mapActions('users', ['getUserById', 'getPolicyByUserId', 'changePassword', 'adminChangePassword']),
...mapGetters('users', ['loading']),
changePass (e) {
@@ -116,7 +117,6 @@
// should never happen
console.warn('Not current user and not admin, API call would fail anyway, not sending');
}
console.log('changePass called');
}
},
created () {
@@ -139,13 +139,17 @@
}
}
}
console.log('watch.policy: setting requiredExternalAuthContacts = '+JSON.stringify(contacts));
// console.log('watch.policy: setting requiredExternalAuthContacts = '+JSON.stringify(contacts));
this.requiredExternalAuthContacts = contacts;
}
},
changePasswordResponse (r) {
if (r) {
console.log('watch.changePasswordResponse: received '+JSON.stringify(r));
if (r.uuid && r.token) {
this.alertSuccess(this.messages['message_change_password_request_sent']);
} else {
this.alertError(this.messages['message_change_password_error']);
}
}
}
}


Зареждане…
Отказ
Запис