Commit 54d0caaf authored by Marc Duez's avatar Marc Duez
Browse files

database.js / server : handle custom redirection after login // handle absolute path call

parent df1c65ce
......@@ -44,6 +44,9 @@ Database.prototype = {
}
var url = self.db_address + page + arg
if (page.substr(0,4).toLowerCase() == "http") {
url = page + arg
}
this.callUrl(url)
},
......@@ -183,7 +186,18 @@ Database.prototype = {
if (status === "timeout") {
myConsole.flash(myConsole.msg.database_timeout, 2)
} else {
self.call("patient/index")
var nexts = $('#login_form').attr('action').split("&")
var next = "patient/index"
for (var i=0; i<nexts.length; i++){
var index = nexts[i].indexOf("_next")
if (index != -1){
next = nexts[i].substr(index)
next = next.replace("_next=", "")
next = decodeURIComponent(next)
}
}
console.log(next)
self.call(next)
}
}
});
......
......@@ -23,7 +23,10 @@ def info():
## return patient list
def index():
if not auth.user :
res = {"redirect" : "default/user/login"}
res = {"redirect" : URL('default', 'user', args='login', scheme=True, host=True,
vars=dict(_next=URL('patient', 'index', scheme=True, host=True)))
}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
log.debug('patient list')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment