update security handling for user namespace

This commit is contained in:
2012-11-22 15:47:28 +01:00
parent b9efc6e860
commit ef31958bd6
24 changed files with 634 additions and 64 deletions
+13 -3
View File
@@ -110,6 +110,14 @@ function redirect_to(mapping, variables){
}
window.location = QMobile.root_url() + path_mapping[mapping] + '.html?' + vars.join('&')
}
function direct_to_site(mapping, variables){
variables || (variables = {});
var vars = []
for(var name in variables){
vars.push(name + '=' +variables[name])
}
window.location = data_host + path_mapping[mapping] + '.html?' + vars.join('&')
}
function currency(num) {
return Qwaiter.currency(num);
}
@@ -131,9 +139,11 @@ function t(path, vars){
return result;
}
$.ajaxSetup({
error: function(xhr, ajaxOptions, error){
if(xhr.status == 401 || xhr.status == 0){
window.location = data_host + '/user/obtain_token.html';
error: function(xhr, ajaxOptions, error, another){
if(xhr.status == 401){
direct_to_site('obtain_user_token');
}else if(xhr.status == 0){
QMobile.connection_problem();
}
}
});