RunestoneInteractive / RunestoneServer

Interactive books for computer science and mathematics
http://runestoneinteractive.org
Other
575 stars 502 forks source link

settings.enable_captchas breaks startup of Runestone Server #1757

Closed ascholerChemeketa closed 2 years ago

ascholerChemeketa commented 3 years ago

If settings.enable_captchas = True is set in models/1.py1 then the runestone server fails to start. (Using docker based server setup). Error below is reported in logs. Disabling that setting allows normal startup.

^[[35mrunestone_1  |^[[0m Initializing the database
^[[35mrunestone_1  |^[[0m Running: python web2py.py --no-banner -S runestone -M -R applications/runestone/rsmanage/initialize_tables.py
^[[35mrunestone_1  |^[[0m Traceback (most recent call last):
^[[35mrunestone_1  |^[[0m   File "/srv/web2py/gluon/restricted.py", line 219, in restricted
^[[35mrunestone_1  |^[[0m     exec(ccode, environment)
^[[35mrunestone_1  |^[[0m   File "applications/runestone/models/db.py", line 128, in <module>
^[[35mrunestone_1  |^[[0m     from gluon.tools import Recaptcha
^[[35mrunestone_1  |^[[0m ImportError: cannot import name 'Recaptcha' from 'gluon.tools' (/srv/web2py/gluon/tools.py)
bnmnetp commented 3 years ago

I don't know if Captchas are supported by web2py anymore or not. I haven't used them in years. This will require a little investigation.

schweinsbergs commented 3 years ago

@LYisus and I are working on this for a project.

Current hunch right now is based on documentation, ours currently is: from gluon.tools import Recaptcha

But the web2py documentation suggests: from gluon.tools import Recaptcha2

Investigating.

Also worth noting: reCAPTCHA may not work if you access the web site as 'localhost' or '127.0.0.1', because it is registered to work with publicly visible web sites only, unless you add them to the domains in the reCAPTCHA admin panel.

schweinsbergs commented 3 years ago

We were working on this, but it seems in the time that we started working on this issue, the 1.py file has been deleted from the main RunestoneServer branch. We're a little confused as to our next moves? @bnmnetp is there any chance you could advise?

bnmnetp commented 3 years ago

1.py was never part of the master branch. It is called 1.py.prototype to indicate that the user should copy it to 1.py and edit it.

schweinsbergs commented 3 years ago

After some work over this weekend, we found that we can enable everything just fine and get it to run, but when I change the keys over to the Google developer keys for reCaptcha2, Runestone will no longer build.

We believe that new keys need to be generated anyhow, and we wanted to check in with you about that.

schweinsbergs commented 2 years ago

@bnmnetp After a bit of fiddling and a bit of research, and I'm decently confident the issue is that captcha is in v1. I wanted to see if you could help us upgrade to v2-- I believe that we need new keys, and generating the keys is done on your Google account and has you register the website and whatnot, so I don't think I should be doing it personally? Let me know if that's not accurate.

schweinsbergs commented 2 years ago

I got the actual button working, but there's no server-side validation. That's the next thing to tackle.

The domains need to be all registered through Google, so it might be best for you to register your own keys and change the ones I made. Otherwise if anyone is running through their own server, there's a good chance the Captcha is gonna break the site for them.

github-actions[bot] commented 2 years ago

Stale issue message