users can only view their own gallery
This commit is contained in:
parent
7dafe683dd
commit
0ff04ae58a
|
@ -83,13 +83,10 @@ async def index(request):
|
||||||
return web.json_response(urls)
|
return web.json_response(urls)
|
||||||
|
|
||||||
|
|
||||||
@routes.get('/gallery/{user_id}', name='gallery')
|
@routes.get('/gallery', name='gallery')
|
||||||
async def gallery(request):
|
async def gallery(request):
|
||||||
"""A user's gallery page."""
|
"""A user's gallery page."""
|
||||||
try:
|
user_id = int(request.cookies.get('userid'))
|
||||||
user_id = int(request.match_info['user_id'])
|
|
||||||
except ValueError:
|
|
||||||
raise web.HTTPNotFound
|
|
||||||
|
|
||||||
async with request.app['pool'].acquire() as conn:
|
async with request.app['pool'].acquire() as conn:
|
||||||
uploads = await conn.fetch(
|
uploads = await conn.fetch(
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
</div>
|
</div>
|
||||||
<nav>
|
<nav>
|
||||||
<span><a href="{{ url('index') }}">Home</a></span>
|
<span><a href="{{ url('index') }}">Home</a></span>
|
||||||
<span><a href="{{ url('gallery', user_id=request.cookies.get('userid')) }}">Gallery</a></span>
|
<span><a href="{{ url('gallery') }}">Gallery</a></span>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user