Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-06-26 16:27:20 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-06-26 17:15:53 +0300
commit555de27567183861a5dce77029f499a10b28ee05 (patch)
tree1e898fd64128039e2277d7a319a7972cdd523322 /apps/oauth2/src
parent43f7ea5852db6375efe1fd2f309eb919e3e97feb (diff)
Validate OAuth2 redirect uri
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/oauth2/src')
-rw-r--r--apps/oauth2/src/App.vue22
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;
+ });
}
},
}