Skip to content

Commit

Permalink
fix(admin): hide saved credentials from user, require client credenti…
Browse files Browse the repository at this point in the history
…als when needed

Signed-off-by: Edward Ly <[email protected]>
  • Loading branch information
edward-ly committed Nov 15, 2024
1 parent c101dcd commit 7b726c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public function getForm(): TemplateResponse {
$userEmail = $this->config->getAppValue(Application::APP_ID, 'docusign_user_email');

$adminConfig = [
'docusign_client_id' => $clientID,
'docusign_client_secret' => $clientSecret,
'docusign_client_id' => $clientID ? 'dummyClientNumber' : '',
'docusign_client_secret' => $clientSecret ? 'dummyClientSecret' : '',
'docusign_token' => $token !== '',
'docusign_user_name' => $userName,
'docusign_user_email' => $userEmail,
Expand Down
27 changes: 23 additions & 4 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,15 @@ export default {
this.loading = true
delay(async () => {
await confirmPassword()
this.saveOptions({
docusign_client_id: this.state.docusign_client_id,
docusign_client_secret: this.state.docusign_client_secret,
})
const options = {}
if (this.state.docusign_client_id !== 'dummyClientNumber') {
options.docusign_client_id = this.state.docusign_client_id
}
if (this.state.docusign_client_secret !== 'dummyClientSecret') {
options.docusign_client_secret = this.state.docusign_client_secret
}
this.saveOptions(options)
}, 2000)()
},
saveOptions(values) {
Expand All @@ -155,6 +160,20 @@ export default {
})
},
onOAuthClick() {
let dummyValueProvided = false
if (this.state.docusign_client_id === 'dummyClientNumber') {
this.state.docusign_client_id = ''
dummyValueProvided = true
}
if (this.state.docusign_client_secret === 'dummyClientSecret') {
this.state.docusign_client_secret = ''
dummyValueProvided = true
}
if (dummyValueProvided) {
showError(t('integration_docusign', 'For security reasons, please enter your client credentials again'))
return
}
const oauthState = Math.random().toString(36).substring(3)
const scopes = [
'signature',
Expand Down

0 comments on commit 7b726c9

Please sign in to comment.