Skip to content

Commit f8a6619

Browse files
asimclaude
andauthored
Fix weather card auth check — session cookie is HttpOnly (#544)
Check csrf_token cookie (readable by JS) instead of session cookie (HttpOnly, invisible to JS) to detect logged-in state. https://claude.ai/code/session_01GRGLA9yj7BpqKiyi6xFwnm Co-authored-by: Claude <noreply@anthropic.com>
1 parent 33e496a commit f8a6619

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

weather/weather.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func CardHTML() string {
2727
var el=document.getElementById('weather-card-content');
2828
var load=document.getElementById('weather-card-loading');
2929
var KEY='mu_weather',KEY_TS='mu_weather_ts',TTL=1800000;
30-
function isLoggedIn(){return document.cookie.indexOf('session=')!==-1}
30+
function isLoggedIn(){return document.cookie.indexOf('csrf_token=')!==-1}
3131
if(!isLoggedIn()){load.innerHTML='<a href="/login" style="color:#888">Log in</a> for weather';return}
3232
var cached=localStorage.getItem(KEY);
3333
var ts=parseInt(localStorage.getItem(KEY_TS)||'0');

0 commit comments

Comments
 (0)