Skip to content

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

humitos
Copy link
Member

@humitos humitos commented Jul 2, 2025

This is just a demo of what we can do and/or how to use the last_login_method template variable. This needs more discussion and work, but opening as a draft to have something to talk over.

Email

Screenshot_2025-07-02_17-33-48

GitHub App

Screenshot_2025-07-02_17-34-33

Requires: readthedocs/readthedocs.org#12286
Closes #421

humitos added 2 commits July 2, 2025 17:32
This is just a demo of what we can do and/or how to use the `last_login_method`
template variable.

Closes #421
@agjohnson
Copy link
Contributor

agjohnson commented Jul 9, 2025

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:

image

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:

image

<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.

@humitos
Copy link
Member Author

humitos commented Jul 10, 2025

I was going to use a tooltip for the menu and buttons:

Tooltips work for me 👍🏼

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?

I'm already doing this in https://github.com/readthedocs/ext-theme/pull/622/files#r2194496182. Do you refer to something different here?

@agjohnson
Copy link
Contributor

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?

@humitos
Copy link
Member Author

humitos commented Jul 14, 2025

OK, this is moving in a good direction 👍🏼 . I only need to attach the buttons to a specific callback to set the cookie, but all the other login to handle the variables in the template are in place:

VCS - GitHub App

Peek.2025-07-14.14-48.webm

VCS - GitLab

Screenshot_2025-07-14_14-51-38

Email

Screenshot_2025-07-14_14-52-50

SSO

Screenshot_2025-07-14_14-54-05

@humitos
Copy link
Member Author

humitos commented Jul 14, 2025

Yes, specifically "do we need to put a label on the menu"? If we're defaulting is it necessary?

Only for email, since there is no other indicator otherwise.

@humitos humitos marked this pull request as ready for review July 14, 2025 15:21
@humitos humitos requested a review from a team as a code owner July 14, 2025 15:21
@humitos humitos requested a review from agjohnson July 14, 2025 15:21
@humitos
Copy link
Member Author

humitos commented Jul 14, 2025

I had to run the development server at localhost for the cookieStore to work. I used this diff:

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.

@humitos
Copy link
Member Author

humitos commented Jul 29, 2025

@agjohnson can you take a look at this and do a final review here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Login: show "Last used" small icon when showing all the options to login
2 participants