-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
directly connect by OAuth from dashboard and file details
and only allow oAuth connection for user Signed-off-by: Artur Neumann <artur@jankaritech.com>
- Loading branch information
1 parent
0918ff1
commit 4063751
Showing
18 changed files
with
331 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<button | ||
class="openproject-oauth" | ||
@click="onOAuthClick"> | ||
<span class="icon icon-external" /> | ||
{{ t('integration_openproject', 'Connect to OpenProject') }} | ||
</button> | ||
</template> | ||
<script> | ||
import axios from '@nextcloud/axios' | ||
import { generateUrl } from '@nextcloud/router' | ||
import { showError } from '@nextcloud/dialogs' | ||
import { translate as t } from '@nextcloud/l10n' | ||
export default { | ||
name: 'OAuthConnectButton', | ||
props: { | ||
requestUrl: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
methods: { | ||
onOAuthClick() { | ||
const oauthState = Math.random().toString(36).substring(3) | ||
const requestUrl = this.requestUrl | ||
+ '&state=' + encodeURIComponent(oauthState) | ||
const req = { | ||
values: { | ||
oauth_state: oauthState, | ||
}, | ||
} | ||
const url = generateUrl('/apps/integration_openproject/config') | ||
axios.put(url, req) | ||
.then(() => { | ||
window.location.replace(requestUrl) | ||
}) | ||
.catch((error) => { | ||
showError( | ||
t('integration_openproject', 'Failed to save OpenProject OAuth state') | ||
+ ': ' + error.message | ||
) | ||
}) | ||
}, | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.