learningequality / ka-lite

KA Lite: lightweight web server for serving core Khan Academy content (videos and exercises) without needing internet connectivity
https://learningequality.org/ka-lite/
Other
457 stars 304 forks source link

Device registration not compulsory to download videos and languages - redirect to device registration page not working #5401

Closed radinamatic closed 7 years ago

radinamatic commented 7 years ago

Summary

Contrary to what used to happen in 0.16 releases, 0.17 does not require the user to register the device in order to download videos and languages.

System information

Please specify the KA Lite version you were using and your operating system!

How to reproduce

  1. Fresh install
  2. Login as Admin
  3. Go to Video or Language tab - you are not redirected to Device Registration

Screenshots

(I'll try to grab a screencast)

Real-life consequences

Users not registering devices and our stats are not up-to-date.

benjaoming commented 7 years ago

Confirmed - will try to see if I can plug the hole by adding a good old redirect on the language and video update pages. There's no harm in this, since these pages are almost useless on a device that doesn't have a connection.

In case a device has videos and content packs, but no internet connection and isn't registered, then the pages are useful for deleting stuff. But it should hardly matter... if someone deploys by copying .kalite folders without registering devices, I can't see why they would make use of the delete function from UI afterwards.

radinamatic commented 7 years ago

Unable to register with today's 0.17b5 installer on Windows 7.

There's no alert message at all, even though the device is reported as not registered, refreshing the register page does nothing, no errors in the console...

w7b

benjaoming commented 7 years ago

Fixed in #5404 :)

benjaoming commented 7 years ago

@radinamatic the actual explanation is that if a device is offline, we don't require registration. Since the online detection part was broken due to a redirect on kalite.learningequality.org, and the function that was supposed to handle and assess the redirect wasn't configured to do so, the function i_am_online assumed the device was offline even though it was online :)

radinamatic commented 7 years ago

Working correctly on the latest .deb:

Online, trying to download a language:

virtualbox_ubuntu 16 10_10_02_2017_11_03_38

Offline, trying to download a language:

virtualbox_ubuntu 16 10_10_02_2017_11_01_53

Offline, trying to download videos:

virtualbox_ubuntu 16 10_10_02_2017_11_01_41

Offline, register page:

virtualbox_ubuntu 16 10_10_02_2017_11_02_16

Once you are online again, auto-registration takes a second! 👍

radinamatic commented 7 years ago

Getting the same error as @mrpau-eduard on OSX Mavericks while registering... 🤔

mavericks

virtualbox_mavericks_10_02_2017_11_48_23

@benjaoming

benjaoming commented 7 years ago

@radinamatic this seems sort of like a different error - because as you can see from the URL, you are already redirected to the registration page.

But I see a much bigger challenge, namely the fact that we don't even dump a traceback on the error page. I would suggest a <textarea> with the error for easy copy-paste and so it doesn't take up the full screen.

It also seems that the 500 page is missing some of the "friendlyness" that we've been talking about on other pages :)

radinamatic commented 7 years ago

@benjaoming Better traceback would certainly be useful! :+1:

mrpau-richard commented 7 years ago

Hi @benjaoming & @radinamatic I have these error logs when I register the device using this windows installer

Error

Sorry, this page is having an unexpected problem - the error is not your fault

Don't let that stop you, try selecting another video or exercise from ~30,000 videos and exercises to continue your learning...

If you are reporting the error, please make sure to include the following information:

URL: /securesync/register/
querystring: <QueryDict: {}>
Exception: Ben is testing

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\django\core\handlers\base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\securesync\devices\views.py", line 31, in register_public_key
    return register_public_key_client(request)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\django\contrib\auth\decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "C:\Python27\lib\site-packages\kalite\packages\dist\annoying\decorators.py", line 92, in wrapper
    output = function(request, *args, **kwargs)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\securesync\devices\views.py", line 46, in register_public_key_client
    raise Exception("Ben is testing")
Exception: Ben is testing
benjaoming commented 7 years ago

facepalming myself

benjaoming commented 7 years ago

Fix is coming, if you want, you can already build against my PR branch, otherwise I'm waiting for the test to pass, then merging ASAP...

https://github.com/learningequality/ka-lite/pull/5406

radinamatic commented 7 years ago

I'm guessing there's no need for me to confirm these... 😂

radinamatic commented 7 years ago

Latest installer by @mrpau-eduard on Windows 7

IE11

virtualbox_ie11 - win7_14_02_2017_20_33_57

Firefox

virtualbox_ie11 - win7_14_02_2017_20_28_11

Error seems the same for both browsers:

URL: /securesync/register/
querystring: <QueryDict: {}>
TypeError: __init__() takes exactly 3 arguments (1 given)

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\django\core\handlers\base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\securesync\devices\views.py", line 31, in register_public_key
    return register_public_key_client(request)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\django\contrib\auth\decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "C:\Python27\lib\site-packages\kalite\packages\dist\annoying\decorators.py", line 92, in wrapper
    output = function(request, *args, **kwargs)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\securesync\devices\views.py", line 61, in register_public_key_client
    reg_response = client.register()
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\securesync\devices\api_client.py", line 52, in register
    if not model.object.verify():
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\securesync\devices\models.py", line 339, in verify
    return self.get_key().verify(self._hashable_representation(), self.signature)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\securesync\devices\models.py", line 219, in get_key
    self.key = crypto.Key(public_key_string=self.public_key)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\fle_utils\crypto.py", line 29, in __init__
    self.set_public_key_string(public_key_string)
  File "C:\Python27\lib\site-packages\kalite\packages\bundled\fle_utils\crypto.py", line 190, in set_public_key_string
    self._public_key = PYRSA.PublicKey.load_pkcs1(public_key_string)
  File "C:\Python27\lib\site-packages\kalite\packages\dist\rsa\key.py", line 63, in load_pkcs1
    return method(keyfile)
  File "C:\Python27\lib\site-packages\kalite\packages\dist\rsa\key.py", line 202, in _load_pkcs1_pem
    return cls._load_pkcs1_der(der)
  File "C:\Python27\lib\site-packages\kalite\packages\dist\rsa\key.py", line 165, in _load_pkcs1_der
    return cls(*as_ints)
TypeError: __init__() takes exactly 3 arguments (1 given)