Skip to content

Commit

Permalink
Merge pull request #5595 from benjaoming/central-develop-into-0.17.x
Browse files Browse the repository at this point in the history
central-develop into 0.17.x [WIP]
  • Loading branch information
Benjamin Bach authored Sep 3, 2019
2 parents 703b862 + bc367a0 commit fe802df
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var ZoneSelectView = Backbone.View.extend({

template: require('./hbtemplates/zone-select.handlebars'),

initialize: function() {
initialize: function(options) {
// Create collections
this.zone_list = new Models.ZoneCollection();

Expand All @@ -117,7 +117,7 @@ var ZoneSelectView = Backbone.View.extend({
// Fetch collection by org_id
this.zone_list.fetch({
data: $.param({
"org_id": this.options.org_id,
"org_id": options.org_id,
"limit": 0
})
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ require("browsernizr/test/canvas");
require("browsernizr/test/touchevents");
var Modernizr = require("browsernizr");

// Expose this as a global object for use in central server inline JS.
global.getCookie = require("utils/get_cookie");

global.$ = $;
global._ = _;
global.sessionModel = new SessionModel();
Expand Down
14 changes: 11 additions & 3 deletions kalite/packages/bundled/securesync/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@

class BaseClient(object):

def __init__(self, host="%s://%s/" % (settings.SECURESYNC_PROTOCOL, settings.CENTRAL_SERVER_HOST), require_trusted=True, verbose=True):
self.parsed_url = urllib2.urlparse.urlparse(host)
self.url = "%s://%s" % (self.parsed_url.scheme, self.parsed_url.netloc)
def __init__(self, host=None, require_trusted=True, verbose=True):

if not host:
if settings.CENTRAL_SERVER_URL:
self.url = settings.CENTRAL_SERVER_URL
else:
self.url = "%s://%s/" % (settings.SECURESYNC_PROTOCOL, settings.CENTRAL_SERVER_HOST)
else:
parsed_url = urllib2.urlparse.urlparse(host)
self.url = "%s://%s" % (self.parsed_url.scheme, self.parsed_url.netloc)

self.require_trusted = require_trusted
self.verbose = verbose

Expand Down
2 changes: 1 addition & 1 deletion kalite/packages/bundled/securesync/devices/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def register_device(request):
# that what should be proper exception namespacing in code being called isn't correctly catching this exception
msg = "\n\n".join([request.body, client_device._hashable_representation(), "Exception: %s" % e, str(type(e)), client_device.signed_by_id, client_device.id, str(request)])
send_mail("Exception while verifying client device", msg, "[email protected]", ["[email protected]"])
return JsonResponseMessageError("Client device must be self-signed with a signature matching its own public key!", code=EC.CLIENT_DEVICE_INVALID_SIGNATURE)
return JsonResponseMessageError("Client device must be self-signed with a signature matching its own public key.", code=EC.CLIENT_DEVICE_INVALID_SIGNATURE)

try:
zone = register_self_registered_device(client_device, models, data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def handle(self, *args, **options):
csrftoken = s.cookies['csrftoken_central']
login_data = dict(username=options["username"], password=options["password"], csrfmiddlewaretoken=csrftoken, next='/')
r = s.post(login_url, data=login_data, headers={"Referer": login_url})
assert r.status_code == 200, "Error logging into central server: " + r.content
assert r.status_code == 200 and "Incorrect user" not in r.content, "Error logging into central server: " + r.content

# register on the central server
reg_url = client.get_registration_url()
Expand All @@ -80,5 +80,3 @@ def handle(self, *args, **options):
own_device = Device.get_own_device()
assert own_device.is_registered(), "Device was not registered successfully..."
sys.stdout.write("Device '%s' has been successfully registered to zone '%s'!\n" % (own_device.id, own_device.get_zone().id))


2 changes: 1 addition & 1 deletion kalite/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Must also be of the form N.N.N for internal use, where N is a non-negative integer
MAJOR_VERSION = "0"
MINOR_VERSION = "17"
PATCH_VERSION = "5"
PATCH_VERSION = "6.dev"
VERSION = "%s.%s.%s" % (MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
SHORTVERSION = "%s.%s" % (MAJOR_VERSION, MINOR_VERSION)

Expand Down

0 comments on commit fe802df

Please sign in to comment.