working on client creation
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
37
de.srsoftware.oidc.web/src/main/resources/en/newclient.js
Normal file
37
de.srsoftware.oidc.web/src/main/resources/en/newclient.js
Normal file
@@ -0,0 +1,37 @@
|
||||
function addClient(){
|
||||
disable('button');
|
||||
var newData = {
|
||||
client_id : getValue('client-id'),
|
||||
name : getValue('client-name'),
|
||||
secret : getValue('client-secret'),
|
||||
redirect_uri : getValue('redirect-urls').split("\n")
|
||||
};
|
||||
fetch(api+'/add/client',{
|
||||
method : 'POST',
|
||||
headers : {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body : JSON.stringify(newData)
|
||||
}).then(handleClientdResponse);
|
||||
|
||||
setText('button','sent…');
|
||||
setTimeout(function(){
|
||||
setText('button','Add client');
|
||||
enable('button');
|
||||
},10000);
|
||||
}
|
||||
|
||||
function handleClientdResponse(response){
|
||||
if (response.ok){
|
||||
redirect("clients.html");
|
||||
} else {
|
||||
setText('button','Failed!');
|
||||
enable('button');
|
||||
}
|
||||
}
|
||||
|
||||
function checkPermissions(){
|
||||
if (user && !user.permissions.includes('MANAGE_CLIENTS')) redirect("index.html");
|
||||
}
|
||||
|
||||
setTimeout(checkPermissions,100);
|
||||
Reference in New Issue
Block a user