Page MenuHomeSoftware Heritage

assets/webapp: Add utility function to check if a user is logged in
ClosedPublic

Authored by anlambert on Tue, May 4, 11:53 AM.

Details

Summary

It enables to check if a user is currently authenticated from javascript code.

Related to T3272

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added a subscriber: ardumont.

lgtm, one question inline.

swh/web/templates/layout.html
58

Is this a hidden field?

This revision is now accepted and ready to land.Tue, May 4, 11:58 AM

Build is green

Patch application report for D5667 (id=20240)

Rebasing onto 97d077ffd3...

Current branch diff-target is up to date.
Changes applied before test
commit a1e05515b912402b9b1e399ecb312ef4352db064
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue May 4 11:49:47 2021 +0200

    assets/webapp: Add utility function to check if a user is logged in
    
    Related to T3272

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/766/ for more details.

swh/web/templates/layout.html
58

Nope, see https://docs.djangoproject.com/en/3.2/ref/templates/builtins/#json-script

This a django template filter I did not know of that dumps JSON into a script tag.