about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/oauth2/groups.py16
-rw-r--r--wqflask/wqflask/templates/oauth2/group_join_or_create.html2
-rw-r--r--wqflask/wqflask/templates/oauth2/join-requests.html3
-rw-r--r--wqflask/wqflask/templates/oauth2/register_user.html2
-rw-r--r--wqflask/wqflask/templates/oauth2/view-user.html2
5 files changed, 21 insertions, 4 deletions
diff --git a/wqflask/wqflask/oauth2/groups.py b/wqflask/wqflask/oauth2/groups.py
index ee4e490b..f9e9bffe 100644
--- a/wqflask/wqflask/oauth2/groups.py
+++ b/wqflask/wqflask/oauth2/groups.py
@@ -115,3 +115,19 @@ def accept_join_request():
         data=request.form).either(
             handle_error("oauth2.group.list_join_requests"),
             __success__)
+
+@groups.route("/reject-join-requests", methods=["POST"])
+@require_oauth2
+def reject_join_request():
+    def __fail__(error):
+        err=process_error()
+        flash(f"{err['error']}: {err['error_description']}", "alert-danger")
+        return redirect(url_for("oauth2.group.list_join_requests"))
+    def __success__(requests):
+        flash("Request was rejected successfully.", "alert-success")
+        return redirect(url_for("oauth2.group.list_join_requests"))
+    return oauth2_post(
+        "oauth2/group/requests/join/reject",
+        data=request.form).either(
+            handle_error("oauth2.group.list_join_requests"),
+            __success__)
diff --git a/wqflask/wqflask/templates/oauth2/group_join_or_create.html b/wqflask/wqflask/templates/oauth2/group_join_or_create.html
index f3abc4ec..95696710 100644
--- a/wqflask/wqflask/templates/oauth2/group_join_or_create.html
+++ b/wqflask/wqflask/templates/oauth2/group_join_or_create.html
@@ -10,7 +10,7 @@
 
   {{flash_me()}}
 
-  {%if group_join_request is defined %}
+  {%if group_join_request is defined  and group_join_request.exists %}
   <p>
     <span class="glyphicon glyphicon-info-sign text-warning"></span>
     &nbsp;
diff --git a/wqflask/wqflask/templates/oauth2/join-requests.html b/wqflask/wqflask/templates/oauth2/join-requests.html
index 996caf2e..0a05eec1 100644
--- a/wqflask/wqflask/templates/oauth2/join-requests.html
+++ b/wqflask/wqflask/templates/oauth2/join-requests.html
@@ -43,7 +43,8 @@
 	      </form>
 	    </td>
 	    <td>
-	      <form method="POST" action="#reject">
+	      <form method="POST"
+		    action="{{url_for('oauth2.group.reject_join_request')}}">
 		<input type="hidden" name="request_id"
 		       value="{{request.request_id}}" />
 		<input type="submit" class="btn btn-danger" value="Reject"
diff --git a/wqflask/wqflask/templates/oauth2/register_user.html b/wqflask/wqflask/templates/oauth2/register_user.html
index 65d28548..27ccbd30 100644
--- a/wqflask/wqflask/templates/oauth2/register_user.html
+++ b/wqflask/wqflask/templates/oauth2/register_user.html
@@ -5,7 +5,7 @@
   <h3>Register User</h3>
 
   <form class="form-horizontal"
-	action="{{url_for('oauth2.toplevel.register_user')}}"
+	action="{{url_for('oauth2.user.register_user')}}"
 	method="POST" id="oauth2-register-user-form">
     <fieldset>
       <legend>Register User</legend>
diff --git a/wqflask/wqflask/templates/oauth2/view-user.html b/wqflask/wqflask/templates/oauth2/view-user.html
index 7360e4d2..6a7d6be5 100644
--- a/wqflask/wqflask/templates/oauth2/view-user.html
+++ b/wqflask/wqflask/templates/oauth2/view-user.html
@@ -22,7 +22,7 @@
 	<span class="text-warning">User is not a member of a group.</span>
       </p>
 
-      {%if group_join_request is defined %}
+      {%if group_join_request is defined and group_join_request.exists %}
       <p>
 	<span class="glyphicon glyphicon-info-sign text-warning"></span>
 	&nbsp;