Commit d29efb23 authored by Nicolas Wavrant's avatar Nicolas Wavrant

javascript now handle connexion and account creation using

basic auth
parent 05913751
...@@ -43,6 +43,8 @@ $(document).ready(function () { ...@@ -43,6 +43,8 @@ $(document).ready(function () {
return false; return false;
} }
send = true; send = true;
var base_url = 'https://' + $("input#username").val() + ':'
+ $("input#password").val() + '@' + location.host
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: $SCRIPT_ROOT + ((hasAccount) ? '/updateAccount' : '/configAccount'), url: $SCRIPT_ROOT + ((hasAccount) ? '/updateAccount' : '/configAccount'),
...@@ -55,7 +57,7 @@ $(document).ready(function () { ...@@ -55,7 +57,7 @@ $(document).ready(function () {
}, },
success: function (data) { success: function (data) {
if (data.code === 1) { if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + "/"; window.location.href = base_url + $SCRIPT_ROOT + '/';
} else { } else {
$("#error").Popup(data.result, {type: 'error', duration: 5000}); $("#error").Popup(data.result, {type: 'error', duration: 5000});
} }
......
...@@ -27,7 +27,9 @@ $(document).ready(function () { ...@@ -27,7 +27,9 @@ $(document).ready(function () {
$("#login").removeClass("button").addClass("dsblebutton"); $("#login").removeClass("button").addClass("dsblebutton");
$.post(url, param, function (data) { $.post(url, param, function (data) {
if (data.code === 1) { if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + '/'; url = 'https://' + param.clogin + ':' + param.cpwd + '@'
+ location.host + $SCRIPT_ROOT + '/';
window.location.href = url;
} else { } else {
$("#error").Popup(data.result, {type: 'alert', duration: 3000}); $("#error").Popup(data.result, {type: 'alert', duration: 3000});
} }
......
...@@ -18,6 +18,5 @@ ...@@ -18,6 +18,5 @@
<input type="reset" class="button" value="reset" /> <input type="reset" class="button" value="reset" />
<input type="submit" class="button" id="login" value="login" /> <input type="submit" class="button" id="login" value="login" />
</div> </div>
<p><a href="https://nwavrant:nicolas@[2001:67c:1254:3b:fc93:4aff:feca:66ac]:50005/">Next</a></p>
</form> </form>
{% endblock %} {% endblock %}
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