Comments (4)
I've been looking into this for #79 and from the looks of it and the documentation says so, too.
There's an example on how to automatically give the correct path here, could you try that and see if it works for you?
from nativeauthenticator.
I'm not running this anymore so I don't have a setup to try it out on, sorry. But at a glance it doesn't look like the same issue, the question was about how to extend the provided templates as a user.
from nativeauthenticator.
That's true, but if you add the nativeauthenticator template directory to the configuration file as instructed over there you should be able to easily extend the templates as you do here.
But since you don't actually run this any more, I'll close this issue.
from nativeauthenticator.
Just came across this issue and this is how we override the template, it requires a trick to modify the login handler since nativeauthenticator change it to native-login.html
instead of the default login.html
. Here is my jupyterhub config (https://github.com/aiidalab/aiidalab-microk8s-deploy/blob/0702fe11c22f85f3bb3094ddf1c44cb2c5aeb207/basehub/values.yaml#L77-L125):
jupyterhub:
... (other settings)
hub:
db:
pvc:
storageClassName: nfs-client
extraConfig:
00-logo: |
c.JupyterHub.logo_file = "/usr/local/share/jupyterhub/static/external/aiidalab-wide-logo.png"
01-auth: |
from tornado.escape import url_escape
from tornado.httputil import url_concat
from nativeauthenticator import NativeAuthenticator
from nativeauthenticator import handlers
class CustomizeLoginHandler(handlers.LoginHandler):
def _render(self, login_error=None, username=None):
"""For 'normal' rendering."""
return self.render_template(
"customize-native-login.html",
next=url_escape(self.get_argument("next", default="")),
username=username,
login_error=login_error,
custom_html=self.authenticator.custom_html,
login_url=self.settings["login_url"],
enable_signup=self.authenticator.enable_signup,
two_factor_auth=self.authenticator.allow_2fa,
authenticator_login_url=url_concat(
self.authenticator.login_url(self.hub.base_url),
{"next": self.get_argument("next", "")},
),
)
class CustomNativeAuthenticator(NativeAuthenticator):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.minimum_password_length = 8
self.check_common_password = True
self.ask_email_on_signup = True
def get_handlers(self, app):
native_handlers = [
(r"/login", CustomizeLoginHandler),
(r"/signup", handlers.SignUpHandler),
(r"/discard/([^/]*)", handlers.DiscardHandler),
(r"/authorize", handlers.AuthorizationAreaHandler),
(r"/authorize/([^/]*)", handlers.ToggleAuthorizationHandler),
# the following /confirm/ must be like in generate_approval_url()
(r"/confirm/([^/]*)", handlers.EmailAuthorizationHandler),
(r"/change-password", handlers.ChangePasswordHandler),
(r"/change-password/([^/]+)", handlers.ChangePasswordAdminHandler),
]
return native_handlers
c.Authenticator.admin_users = {'admin'}
c.JupyterHub.authenticator_class = CustomNativeAuthenticator
and I have customize-native-login.html
in the template path as modifing login.html
as mentioned in the documentation
{% extends "native-login.html" %}
{% block title %}PSI AiiDAlab - Login{% endblock %}
....
from nativeauthenticator.
Related Issues (20)
- docs: fix c.JupyterHub.template_paths
- Confirmation email still sent for allow-listed users
- Enforce no slashes in usernames HOT 1
- Users created from the admin panel control hub are unusable due to lack of password when using NativeAuthenticator HOT 3
- Prepare for deprecation of Authenticator.db HOT 1
- Use user email as username HOT 1
- Release needed for JupyterHub 2 and 3 compatibility HOT 2
- import_from_firstuse not working: Previous users cannot log in or create an account. HOT 1
- Ability to set user environment path (bin folder) for users to use their own kernels HOT 1
- ci: our test system is failing
- '_xsrf' missing in login, signup and password changing pages HOT 1
- Planning for release 1.2.0 - JupyterHub 4 compatibility HOT 1
- Sign-Up email is not sent to admin for registration pending approval HOT 1
- locale.getdefaultlocale() is deprecated HOT 2
- Main branch tests are broken with jupyterhub 1.5.1 and sqlalchemy 1 HOT 1
- Unable to change password with TLJH JupyterHub 4.0.2 HOT 2
- Authorize Users link not showing for RBAC-authorized users HOT 1
- Test failure in main branch
- Automatically notify the user once his account is authorized HOT 1
- SSL: WRONG_VERSION_NUMBER HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativeauthenticator.