summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-01-14 09:00:25 +0100
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-01-14 09:08:04 +0100
commit96d2797ec3dd4e37b668c58c43dce26ce24968d6 (patch)
tree013abca8980578962005269fac3ac7397b5376d3 /ogcp/views.py
parentc34da1e09876f6b053ee50acf29538625a800d3a (diff)
Fix "Add client" form redirectionv0.9
Otherwise, ogcp redirects to a blank page instead of the scopes view.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 07a54ae..c309003 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -611,9 +611,12 @@ def action_client_add():
"serial_number": form.serial_number.data}
r = g.server.post('/client/add', payload)
- if r.status_code == requests.codes.ok:
- return make_response("200 OK", 200)
- return make_response("400 Bad Request", 400)
+ if r.status_code != requests.codes.ok:
+ flash(_('ogServer: error adding client'),
+ category='error')
+ else:
+ flash(_('Client added successfully'), category='info')
+ return redirect(url_for("scopes"))
else:
r = g.server.get('/mode')
available_modes = [(mode, mode) for mode in r.json()['modes']]