-
Notifications
You must be signed in to change notification settings - Fork 4
Show "Last login" label next to the login method #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This is just a demo of what we can do and/or how to use the `last_login_method` template variable. Closes #421
|
One concern I have about using a label and putting the label inside the menu item is that this menu already has space constraints, especially business accessing private versions: With an added label it's going to be very tight and might wrap the menu or menu items. I was going to use a tooltip for the menu and buttons: <button class="ui button" type="submit" title="GitLab" data-tooltip="Last used" data-variation="teal visible" data-position="right center">I think even the menu labeled options could be rethought here though. We should probably just default to the correct tab, no? Do we need a label on this menu? This is something you'd do at the template level, no JS should be required. We talked in #421 about passing some value to the templates so the templates could render the elements. |
Tooltips work for me 👍🏼
I'm already doing this in https://github.com/readthedocs/ext-theme/pull/622/files#r2194496182. Do you refer to something different here? |
Yes, specifically "do we need to put a label on the menu"? If we're defaulting is it necessary? |
…last-login-method-label
Show a "Last used" tooltip on each of the buttons
Only for email, since there is no other indicator otherwise. |
|
I had to run the development server at diff --git a/dockerfiles/nginx/default.conf.template b/dockerfiles/nginx/default.conf.template
new file mode 100644
index 00000000..e69de29b
diff --git a/dockerfiles/nginx/web.conf.template b/dockerfiles/nginx/web.conf.template
index 9badfd39..69659d14 100644
--- a/dockerfiles/nginx/web.conf.template
+++ b/dockerfiles/nginx/web.conf.template
@@ -1,6 +1,6 @@
server {
- listen 80;
- server_name $NGINX_WEB_SERVER_NAME;
+ listen 80 default_server;
+ server_name $NGINX_WEB_SERVER_NAME localhost;
location /static/ {
proxy_pass http://storage:9000/static/;
@@ -9,10 +9,10 @@ server {
location / {
proxy_pass http://web:8000/;
- proxy_set_header Host $http_host;
+ proxy_set_header Host devthedocs.com;
+ proxy_set_header X-Forwarded-Host devthedocs.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Host $host;
add_header X-Served Django always;
}
@@ -30,6 +30,4 @@ server {
add_header X-Served Nginx-Proxito-Sendfile always;
}
-
-
}
diff --git a/dockerfiles/nginx/wrangler.conf.template b/dockerfiles/nginx/wrangler.conf.template
index b99d1fae..82a6fa12 100644
--- a/dockerfiles/nginx/wrangler.conf.template
+++ b/dockerfiles/nginx/wrangler.conf.template
@@ -1,6 +1,6 @@
# Proxito
server {
- listen 80 default_server;
+ listen 80;
server_name $NGINX_PROXITO_SERVER_NAME;
# Docker Compose's "logging.driver: none" is not working anymore. |
|
@agjohnson can you take a look at this and do a final review here? |
|
@agjohnson this is ready for review -- can you take a look? |
| <div class="right menu"> | ||
| <button class="ui primary button" type="submit">{% trans "Log in" %}</button> | ||
| <button class="ui primary button" | ||
| data-bind="click: $root.save_login_method" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't use $root here, this method should be in a dedicated view class. $root is currently only used for some utility methods that are shared across many views.
| <a href="{% url "saml_resolve_login" %}{% if redirect_field_value %}?{{ redirect_field_name }}={{ redirect_field_value }}{% endif %}"> | ||
|
|
||
| <button class="ui button" | ||
| data-bind="click: $root.save_login_method" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another mention of $root, should be a method in a view class.
| action="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}"> | ||
| {% csrf_token %} | ||
|
|
||
| {# djlint: off #} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use something less generic than off. If there is a rule you're trying to avoid, limit it to that rule.
|
|
||
| {# djlint: off #} | ||
| <button class="ui {{ button_classes }} button" | ||
| data-bind="click: $root.save_login_method" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another $root
| variation.pop("visible"); | ||
| button.dataset.variation = variation.join(" "); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should always use KO view code to manipulate the DOM. Using JS queries or jQuery to manipulate the DOM in addition is mixing patterns and should be always avoided.
I'm a bit confused what this is trying to do though. What is the intention here? It also seems like this would affect all modals, which we don't want.
| cookieStore.set("last-login-method", elem.dataset.provider); | ||
| } | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be implemented on a dedicated view class, not on the main application view. The main application view is strictly a router to these dedicated views and a couple utility methods.
You should look at any of the other templates that use a model view and work from those templates, they all follow the same pattern with a dedicated view class for each view.
| * .. code:: html | ||
| * | ||
| * <form method="post" action="..."> | ||
| * <button data-bind="click: $root.save_login_method"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also $root here.





This is just a demo of what we can do and/or how to use the
last_login_methodtemplate variable. This needs more discussion and work, but opening as a draft to have something to talk over.Email
GitHub App
Requires: readthedocs/readthedocs.org#12286
Closes #421