diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-06-26 15:27:20 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-06-26 16:15:53 +0200 |
commit | 555de27567183861a5dce77029f499a10b28ee05 (patch) | |
tree | 1e898fd64128039e2277d7a319a7972cdd523322 /apps/oauth2/src/App.vue | |
parent | 43f7ea5852db6375efe1fd2f309eb919e3e97feb (diff) | |
download | nextcloud-server-555de27567183861a5dce77029f499a10b28ee05.tar.gz nextcloud-server-555de27567183861a5dce77029f499a10b28ee05.zip |
Validate OAuth2 redirect uri
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/oauth2/src/App.vue')
-rw-r--r-- | apps/oauth2/src/App.vue | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/apps/oauth2/src/App.vue b/apps/oauth2/src/App.vue index 0b502c1da02..32a0b07a011 100644 --- a/apps/oauth2/src/App.vue +++ b/apps/oauth2/src/App.vue @@ -44,6 +44,7 @@ <br/> <h3>{{ t('oauth2', 'Add client') }}</h3> + <span v-if="newClient.error" class="msg error">{{newClient.errorMsg}}</span> <form @submit.prevent="addClient"> <input type="text" id="name" name="name" :placeholder="t('oauth2', 'Name')" v-model="newClient.name"> <input type="url" id="redirectUri" name="redirectUri" :placeholder="t('oauth2', 'Redirection URI')" v-model="newClient.redirectUri"> @@ -66,7 +67,9 @@ export default { clients: [], newClient: { name: '', - redirectUri: '' + redirectUri: '', + errorMsg: '', + error: false } }; }, @@ -92,6 +95,7 @@ export default { addClient() { let requestToken = OC.requestToken; let tokenHeaders = { headers: { requesttoken: requestToken } }; + this.newClient.error = false; axios.post( OC.generateUrl('apps/oauth2/clients'), @@ -99,14 +103,16 @@ export default { name: this.newClient.name, redirectUri: this.newClient.redirectUri }, - tokenHeaders) - .then((response) => { - this.clients.push(response.data) + tokenHeaders + ).then(response => { + this.clients.push(response.data); - this.newClient.name = ''; - this.newClient.redirectUri = ''; - } - ); + this.newClient.name = ''; + this.newClient.redirectUri = ''; + }).catch(reason => { + this.newClient.error = true; + this.newClient.errorMsg = reason.response.data.message; + }); } }, } |