[ Login and logout ]

This commit is contained in:
Mateus Cezário Barreto 2025-11-02 17:36:00 -03:00
commit fb229b3950
4 changed files with 159 additions and 23 deletions

View file

@ -98,29 +98,11 @@ class TonTon::App < Precious::App
end
before do
public_patterns = [
'/',
'/*',
'/login',
'/logout',
'/unauthenticated',
'/gollum/*',
'/gollum/history/**',
'/gollum/latest_changes',
'/gollum/commit/**'
]
request_path = Pathname.new(request.path_info)
looks_public = false
for pattern in public_patterns
if request_path.fnmatch(pattern, File::FNM_PATHNAME)
looks_public = true
end
if not env['warden'].authenticated?
@allow_editing = false
else
@allow_editing = true
end
if not looks_public then check_authentication end
end
post '/unauthenticated' do