From b494d75de66ef5c3e9be8758497ec1687ff86655 Mon Sep 17 00:00:00 2001
From: henu
Date: Tue, 25 Oct 2016 19:32:05 +0300
Subject: [PATCH] Captcha working on application and redirection after sending
application
---
members/static/js/application_controllers.js | 9 +++---
members/templates/application_index.html | 4 +--
members/templates/application_success.html | 15 ++++++++++
members/views.py | 31 ++++++++++++--------
requirements.txt | 1 +
sikweb/urls.py | 2 ++
6 files changed, 44 insertions(+), 18 deletions(-)
create mode 100644 members/templates/application_success.html
diff --git a/members/static/js/application_controllers.js b/members/static/js/application_controllers.js
index 4e7a7bc..1e3aa7b 100644
--- a/members/static/js/application_controllers.js
+++ b/members/static/js/application_controllers.js
@@ -31,7 +31,7 @@ app.controller("applicationController", function($scope, $http, $location, $wind
$scope.response = null;
$scope.widgetId = null;
$scope.model = {
- key: '6LevHAcUAAAAAA45B7c-7qja-2aSwHztr9xb4K2Z'
+ key: "6LevHAcUAAAAAA45B7c-7qja-2aSwHztr9xb4K2Z"
};
$scope.setResponse = function(response) {
$scope.response = response;
@@ -47,16 +47,17 @@ app.controller("applicationController", function($scope, $http, $location, $wind
var valid;
//server side validation
$scope.member.reCaptchaResponse = vcRecaptchaService.getResponse()
- if($scope.member.reCaptchaResponse === "") {
+ console.log($scope.member.reCaptchaResponse);
+ if($scope.member.reCaptchaResponse === "") {
notyError("Ole hyvä ja täytä kuvavarmennus");
} else {
$http.post("/members/api/request", $scope.member).then(function(data){
notySuccess("Hakemus lähetetty!");
- $window.location.href = "/application/";
+ $window.location.href = "/application/success";
}, function(data){
notyError("Jokin meni vikaan. Yritä uudelleen.");
vcRecaptchaService.reload($scope.widgetId);
});
}
}
-});
\ No newline at end of file
+});
diff --git a/members/templates/application_index.html b/members/templates/application_index.html
index 2c54ac2..7457cc9 100644
--- a/members/templates/application_index.html
+++ b/members/templates/application_index.html
@@ -64,7 +64,7 @@
Tallenna
-
+ Hienoa! Jäsenhakemuksesi on nyt lähetetty.
+ Takaisin Sähköinsinöörikillan web-sivuille
+
\ No newline at end of file
+
diff --git a/members/templates/application_success.html b/members/templates/application_success.html
new file mode 100644
index 0000000..370a897
--- /dev/null
+++ b/members/templates/application_success.html
@@ -0,0 +1,15 @@
+
+
+