Commit aca53249 authored by Ozzie Isaacs's avatar Ozzie Isaacs

Bugfix arrange shelf

Bugfix remote login
Bugfix perform Update
parent d8f9e2fe
...@@ -1745,6 +1745,7 @@ def ldap_import_create_user(user, user_data): ...@@ -1745,6 +1745,7 @@ def ldap_import_create_user(user, user_data):
content.kindle_mail = kindlemail content.kindle_mail = kindlemail
content.default_language = config.config_default_language content.default_language = config.config_default_language
content.locale = config.config_default_locale content.locale = config.config_default_locale
content.role = config.config_default_role
content.sidebar_view = config.config_default_show content.sidebar_view = config.config_default_show
content.allowed_tags = config.config_allowed_tags content.allowed_tags = config.config_allowed_tags
content.denied_tags = config.config_denied_tags content.denied_tags = config.config_denied_tags
......
...@@ -263,7 +263,7 @@ $(function() { ...@@ -263,7 +263,7 @@ $(function() {
function updateTimer() { function updateTimer() {
$.ajax({ $.ajax({
dataType: "json", dataType: "json",
url: window.location.pathname + "/../../get_updater_status", url: getPath() + "/get_updater_status",
success: function success(data) { success: function success(data) {
$("#DialogContent").html(updateText[data.status]); $("#DialogContent").html(updateText[data.status]);
if (data.status > 6) { if (data.status > 6) {
...@@ -462,8 +462,8 @@ $(function() { ...@@ -462,8 +462,8 @@ $(function() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
dataType: "json", dataType: "json",
data: { start: "True"}, data: { start: "True" },
url: window.location.pathname + "/../../get_updater_status", url: getPath() + "/get_updater_status",
success: function success(data) { success: function success(data) {
updateText = data.text; updateText = data.text;
$("#DialogContent").html(updateText[data.status]); $("#DialogContent").html(updateText[data.status]);
......
...@@ -35,6 +35,7 @@ function sendData(path) { ...@@ -35,6 +35,7 @@ function sendData(path) {
var form = document.createElement("form"); var form = document.createElement("form");
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.setAttribute("action", path); form.setAttribute("action", path);
// form.setAttribute("csrf_token", );
for (counter = 0;counter < maxElements;counter++) { for (counter = 0;counter < maxElements;counter++) {
tmp[counter] = elements[counter].getAttribute("id"); tmp[counter] = elements[counter].getAttribute("id");
...@@ -44,6 +45,10 @@ function sendData(path) { ...@@ -44,6 +45,10 @@ function sendData(path) {
hiddenField.setAttribute("value", String(counter + 1)); hiddenField.setAttribute("value", String(counter + 1));
form.appendChild(hiddenField); form.appendChild(hiddenField);
} }
$("<input type='hidden'/>")
.attr("name", "csrf_token").val($("input[name='csrf_token']").val())
.appendTo(form);
document.body.appendChild(form); document.body.appendChild(form);
form.submit(); form.submit();
} }
...@@ -186,6 +186,7 @@ ...@@ -186,6 +186,7 @@
</table> </table>
{% if feature_support['updater'] %} {% if feature_support['updater'] %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="hidden" id="update_error"> <span>{{update_error}}</span></div> <div class="hidden" id="update_error"> <span>{{update_error}}</span></div>
<div class="btn btn-primary" id="check_for_update">{{_('Check for Update')}}</div> <div class="btn btn-primary" id="check_for_update">{{_('Check for Update')}}</div>
<div class="btn btn-primary hidden" id="perform_update" data-toggle="modal" data-target="#StatusDialog">{{_('Perform Update')}}</div> <div class="btn btn-primary hidden" id="perform_update" data-toggle="modal" data-target="#StatusDialog">{{_('Perform Update')}}</div>
......
{% extends "layout.html" %} {% extends "layout.html" %}
{% block body %} {% block body %}
<div class="well"> <div class="well">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<h2 style="margin-top: 0">{{_('Magic Link - Authorise New Device')}}</h2> <h2 style="margin-top: 0">{{_('Magic Link - Authorise New Device')}}</h2>
<p> <p>
{{_('On another device, login and visit:')}} {{_('On another device, login and visit:')}}
<h4><a id="verify_url" data-token="{{token}}" href="{{verify_url}}">{{verify_url}}</a></b> <h4><a id="verify_url" data-token="{{token}}" href="{{verify_url}}">{{verify_url}}</a><b></b>
</h4> </h4>
<p> <p>
{{_('Once verified, you will automatically be logged in on this device.')}} {{_('Once verified, you will automatically be logged in on this device.')}}
...@@ -17,26 +18,4 @@ ...@@ -17,26 +18,4 @@
{% block js %} {% block js %}
<script src="{{ url_for('static', filename='js/remote_login.js') }}"></script> <script src="{{ url_for('static', filename='js/remote_login.js') }}"></script>
<!--script type="text/javascript">
(function () {
// Poll the server to check if the user has authenticated
var t = setInterval(function () {
$.post('{{url_for("remotelogin.token_verified")}}', { token: '{{token}}' })
.done(function(response) {
if (response.status === 'success') {
// Wait a tick so cookies are updated
setTimeout(function () {
window.location.href = '{{url_for("web.index")}}';
}, 0);
}
})
.fail(function (xhr) {
clearInterval(t);
var response = JSON.parse(xhr.responseText);
alert(response.message);
});
}, 5000);
})()
</script-->
{% endblock %} {% endblock %}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<div class="col-sm-8 col-lg-8 col-xs-12"> <div class="col-sm-8 col-lg-8 col-xs-12">
<h2>{{title}}</h2> <h2>{{title}}</h2>
<div>{{_('Drag to Rearrange Order')}}</div> <div>{{_('Drag to Rearrange Order')}}</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div id="sortTrue" class="list-group"> <div id="sortTrue" class="list-group">
{% for entry in entries %} {% for entry in entries %}
<div id="{{entry['Books']['id']}}" class="list-group-item"> <div id="{{entry['Books']['id']}}" class="list-group-item">
......
...@@ -23,7 +23,6 @@ from sqlalchemy.sql.expression import func ...@@ -23,7 +23,6 @@ from sqlalchemy.sql.expression import func
from werkzeug.security import check_password_hash from werkzeug.security import check_password_hash
from flask_login import login_required, login_user from flask_login import login_required, login_user
from . import lm, ub, config, constants, services from . import lm, ub, config, constants, services
try: try:
......
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