# Conflicts: # src/auth/LoginPage.vuepull/8/head
@@ -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)); | |||
@@ -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; | |||
@@ -17,6 +17,8 @@ const state = { | |||
locales: ['en_US'], | |||
cloudConfigs: {}, | |||
sslPort: null, | |||
locked: null, | |||
launchLock: null, | |||
promoCodePolicy: null, | |||
requireSendMetrics: null, | |||
isInRestoringStatus: false | |||
@@ -25,7 +27,6 @@ const state = { | |||
searchResults: [], | |||
status: { activating: false, searching: false, creatingEntity: false, modelSetupInProgress: false }, | |||
activated: null, | |||
locked: null, | |||
error: null, | |||
messages: { | |||
durationToMillis: function(count, units) { | |||
@@ -36,7 +36,7 @@ | |||
}; | |||
}, | |||
computed: { | |||
...mapState('apps', ['mitmEnabled', 'apps', 'app', 'icons']), | |||
...mapState('apps', ['apps', 'app', 'icons']), | |||
...mapState('system', ['messages']) | |||
}, | |||
created () { | |||
@@ -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; | |||
} | |||
} | |||
}; |
@@ -208,11 +208,33 @@ | |||
<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> | |||
<!-- launch lock --> | |||
<div class="form-group" v-if="networkType !== 'fork'"> | |||
<label for="launchLock">{{messages.field_label_launch_lock}}</label> | |||
<input type="checkbox" id="launchLock" v-model="accountPlan.launchLock"> | |||
<div v-if="submitted && errors.has('launchLock')" class="invalid-feedback d-block">{{ errors.first('launchLock') }}</div> | |||
<p>{{messages.field_label_launch_lock_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 +358,9 @@ | |||
}, | |||
sshKey: '', | |||
forkHost: '', | |||
syncPassword: true, | |||
launchLock: false, | |||
sendErrors: true, | |||
sendMetrics: true | |||
}, | |||
networkType: 'bubble', | |||
@@ -602,7 +627,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, | |||
@@ -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']); | |||
} | |||
} | |||
} | |||
} | |||
@@ -64,7 +64,7 @@ | |||
<input v-validate="'required'" v-model="totpToken" name="totpToken" class="form-control"/> | |||
<div v-if="submitted && errors.has('totpToken')" class="invalid-feedback d-block">{{ errors.first('totpToken') }}</div> | |||
</div> | |||
<div v-if="configs && configs.locked === true" class="form-group"> | |||
<div v-if="configs && configs.locked === true && (configs.launchLock === null || configs.launchLock)" class="form-group"> | |||
<label htmlFor="unlockKey">{{messages.field_label_unlock_key}}</label> | |||
<input type="password" v-model="unlockKey" name="unlockKey" class="form-control" :class="{ 'is-invalid': submitted && !unlockKey }" /> | |||
<div v-show="submitted && !unlockKey" class="invalid-feedback">Unlock Key is required</div> | |||