added landing page to client properties

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-09-17 11:33:13 +02:00
parent bb5d507a13
commit 2250a78e91
13 changed files with 93 additions and 41 deletions

View File

@@ -19,9 +19,11 @@
<th>Client</th>
<th>ID</th>
<th>Redirect URLs</th>
<th>Landing page</th>
<th>Actions</th>
</tr>
<tr id="bottom">
<td></td>
<td></td>
<td></td>
<td>

View File

@@ -15,14 +15,14 @@
<fieldset class="wide">
<legend>Data</legend>
<table>
<tr>
<th>ID</th>
<td><input type="text" disabled="true" id="client-id" /></td>
</tr>
<tr>
<th>Name</th>
<td><input type="text" id="client-name" /></td>
</tr>
<tr>
<th>ID</th>
<td><input type="text" disabled="true" id="client-id" /></td>
</tr>
<tr>
<th>Secret</th>
<td><input type="text" id="client-secret" /></td>
@@ -33,6 +33,10 @@
<textarea id="redirect-urls"></textarea>
</td>
</tr>
<tr>
<th>Landing page</th>
<td><input type="text" id="landing-page" /></td>
</tr>
<tr>
<td></td>
<td><button type="button" id="button" onclick="updateClient();">Update</button></td>

View File

@@ -17,21 +17,25 @@
<legend>Settings</legend>
<table>
<tr>
<th>client id</th>
<td><input type="text" size="50" id="client-id"></td>
</tr>
<tr>
<th>client name</th>
<th>Client Name</th>
<td><input type="text" size="50" id="client-name"></td>
</tr>
<tr>
<th>client secret</th>
<th>Client ID</th>
<td><input type="text" size="50" id="client-id"></td>
</tr>
<tr>
<th>Client Secret</th>
<td><input type="text" size="50" id="client-secret"></td>
</tr>
<tr>
<th>redirect urls</th>
<th>Redirect URLs</th>
<td><textarea cols="50" rows="5" id="redirect-urls"></textarea></td>
</tr>
<tr>
<th>Landing page</th>
<td><input type="text" size="50" id="landing-page" /></td>
</tr>
<tr>
<td></td>
<td><button id="button" type="button" onclick="addClient()">Add client</button></td>

View File

@@ -15,6 +15,7 @@ function handleClients(response){
row.innerHTML = `<td>${client.name}</td>
<td>${id}</td>
<td>${client.redirect_uris.join("<br/>")}</td>
<td>${link(client.landing_page)}</td>
<td>
<button type="button" onclick="edit('${id}')">Edit</button>
<button class="danger" onclick="remove('${id}')" type="button">Remove</button>
@@ -24,6 +25,10 @@ function handleClients(response){
});
}
function link(url){
return url ? '<a href="'+url+'">'+url.split('?')[0]+'</a>': "";
}
function handleRemove(response){
redirect("clients.html");
}

View File

@@ -9,6 +9,7 @@ function handleLoadResponse(response){
get('client-name').value = json.name;
get('client-secret').value = json.secret;
get('redirect-urls').value = json.redirect_uris.join("\n");
get('landing-page').value = json.landing_page?json.landing_page:'';
});
}
}
@@ -17,6 +18,7 @@ function handleUpdateResponse(response){
if (response.ok) {
enable('button');
setText('button','saved.');
redirect('clients.html');
}
}
@@ -32,7 +34,8 @@ function updateClient(){
client_id : getValue('client-id'),
name : getValue('client-name'),
secret : getValue('client-secret'),
redirect_uris : getValue('redirect-urls').split("\n")
redirect_uris : getValue('redirect-urls').split("\n"),
landing_page : getValue('landing-page')
};
fetch(client_controller+'/update',{
method : 'POST',

View File

@@ -4,7 +4,8 @@ function addClient(){
client_id : getValue('client-id'),
name : getValue('client-name'),
secret : getValue('client-secret'),
redirect_uris : getValue('redirect-urls').split("\n")
redirect_uris : getValue('redirect-urls').split("\n"),
landing_page : getValue('landing-page')
};
fetch(client_controller+'/add',{
method : 'POST',