Skip to content

Commit e449dfe

Browse files
committed
[KNOWAGE-7880] fix url building in user registration jsp
1 parent 98eb7f8 commit e449dfe

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

  • knowage/src/main/webapp/themes/sbi_default/jsp/signup

knowage/src/main/webapp/themes/sbi_default/jsp/signup/active.jsp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3434
IUrlBuilder urlBuilder = UrlBuilderFactory.getUrlBuilder("WEB");
3535
String baseUrl = urlBuilder.getResourceLink(request, "restful-services/signup/active");
3636
String getURL=request.getRequestURL().toString().substring(0, request.getRequestURL().toString().indexOf("knowage")) + "knowage/";
37+
baseUrl = getURL + "restful-services/signup/active";
3738
String currTheme = ThemesManager.getDefaultTheme();
3839
%>
3940

@@ -112,7 +113,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
112113
</div>
113114
<script>
114115
var baseUrl = "<%= baseUrl %>";
115-
116+
116117
angular.module('userActivation',[])
117118
.config(['$locationProvider', function($locationProvider) {
118119
$locationProvider.html5Mode({ enabled: true, requireBase: false }); }]
@@ -150,14 +151,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
150151
$scope.translate = sbiModule_translate;
151152
$scope.loading = true;
152153
$scope.location = $location;
153-
debugger;
154154
$scope.version = $location.search().version.match(/^[0-9]{1,2}\.[0-9]{1,2}$/) ? $location.search().version : "master";
155155
var url = new URL(baseUrl);
156156
url.searchParams.append('token', $location.search().token);
157157
url.searchParams.append('locale', $location.search().locale);
158158
url.searchParams.append('version', $scope.version);
159-
160-
$http.get(url.toString())
159+
160+
var urlString = url.toString();
161+
urlString = urlString.substring(urlString.indexOf("/knowage"));
162+
163+
var uniqueToken = localStorage.getItem('X-CSRF-TOKEN') || (Math.random() + 1).toString(36);
164+
document.cookie = "X-CSRF-TOKEN=" + uniqueToken + "; path=/";
165+
$http.get(urlString, {
166+
headers: {
167+
'x-csrf-token': uniqueToken,
168+
}
169+
})
161170
.then(function(response){
162171
$scope.loading = false;
163172
if(response.data.errors){

0 commit comments

Comments
 (0)