return an error when trying to register a deleted user
Scott Baker [Thu, 29 Jan 2015 00:11:35 +0000 (16:11 -0800)]
planetstack/core/dashboard/views/tenant.py
planetstack/templates/admin/login.html

index a64250f..7794bf2 100644 (file)
@@ -26,6 +26,10 @@ class RequestAccessView(View):
              else:
                  return HttpResponse(json.dumps({"error": "already_pending"}), content_type='application/javascript')
 
+        user=User.deleted_objects.filter(email=BaseUserManager.normalize_email(email))
+        if (user):
+            return HttpResponse(json.dumps({"error": "is_deleted"}), content_type='application/javascript')
+
        user = User(
             email=BaseUserManager.normalize_email(email),
             firstname=firstname,
index 37f1055..29534db 100644 (file)
@@ -139,10 +139,13 @@ $("#request-signup").unbind().click(function(){
                                                                         } else if (response.error == "already_pending") {
                                                                             alert("Your request is already pending and awaiting approval");
                                                                             return;
+                                                                        } else if (response.error == "is_deleted") {
+                                                                            alert("Your user record is in a deleted state. Please contact OpenCloud support");
+                                                                            return;
                                                                         }
                                                                     }
-                                                                       $("#request-account-form").dialog("close");     
-                                                                       alert("Your request has been submitted");                                                       
+                                                                   $("#request-account-form").dialog("close");
+                                                                   alert("Your request has been submitted");
                                                                },
                                                                error:function (xhr, textStatus, thrownError){
                                                                   alert("Error:", textStatus + " " + xhr.responseText);