Skip to content

Commit 94111e0

Browse files
creatig rtl page and logout function
1 parent d0e87d9 commit 94111e0

File tree

7 files changed

+1225
-24
lines changed

7 files changed

+1225
-24
lines changed

src/routers/auth/auth_routes.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from fastapi import APIRouter, Depends, status, Response, HTTPException
1+
from fastapi import APIRouter, Depends, status, Response, HTTPException, Request
2+
from fastapi.responses import RedirectResponse
3+
from fastapi.responses import HTMLResponse
24
from fastapi.security.oauth2 import OAuth2PasswordRequestForm
35
from sqlalchemy.orm import Session
46

@@ -30,4 +32,17 @@ async def login(user_credentials: OAuth2PasswordRequestForm = Depends(), db: Ses
3032
return {
3133
"access_token" : access_token,
3234
"token_type" : "bearer"
33-
}
35+
}
36+
37+
38+
@router.post('/logout', response_model=schemas.Token)
39+
async def logout(request: Request, response_model=HTMLResponse):
40+
auth_token = request.cookies.get('Authorization')
41+
42+
if (auth_token):
43+
request.cookies.pop('Authorization')
44+
45+
return RedirectResponse(router.url_path_for('signin'))
46+
# verify = oauth2.get_current_user(auth_token)
47+
48+
return RedirectResponse(router.url_path_for('home'))

src/templates/home/profile.html

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<div class="container-fluid">
1111

12-
<div class="page-header min-height-300 border-radius-xl mt-4" style="background-image: url("{{ url_for('static', path='img/curved-images/curved0.jpg') }}"); background-position-y: 50%;">
12+
<div class="page-header min-height-300 border-radius-xl mt-4" style="background-position-y: 50%; background-image: url({{url_for('static', path='/img/curved-images/curved0.jpg')}})">
1313
<span class="mask bg-gradient-primary opacity-6"></span>
1414
</div>
1515
<div class="card card-body blur shadow-blur mx-4 mt-n6 overflow-hidden">
@@ -202,7 +202,7 @@ <h6 class="mb-0">Conversations</h6>
202202
<ul class="list-group">
203203
<li class="list-group-item border-0 d-flex align-items-center px-0 mb-2">
204204
<div class="avatar me-3">
205-
<img src="{{ url_for('static', path='') }}/img/kal-visuals-square.jpg" alt="kal" class="border-radius-lg shadow">
205+
<img src="{{ url_for('static', path='img/kal-visuals-square.jpg') }}" alt="kal" class="border-radius-lg shadow">
206206
</div>
207207
<div class="d-flex align-items-start flex-column justify-content-center">
208208
<h6 class="mb-0 text-sm">Sophie B.</h6>
@@ -212,7 +212,7 @@ <h6 class="mb-0 text-sm">Sophie B.</h6>
212212
</li>
213213
<li class="list-group-item border-0 d-flex align-items-center px-0 mb-2">
214214
<div class="avatar me-3">
215-
<img src="{{ url_for('static', path='') }}/img/marie.jpg" alt="kal" class="border-radius-lg shadow">
215+
<img src="{{ url_for('static', path='img/marie.jpg') }}" alt="kal" class="border-radius-lg shadow">
216216
</div>
217217
<div class="d-flex align-items-start flex-column justify-content-center">
218218
<h6 class="mb-0 text-sm">Anne Marie</h6>
@@ -222,7 +222,7 @@ <h6 class="mb-0 text-sm">Anne Marie</h6>
222222
</li>
223223
<li class="list-group-item border-0 d-flex align-items-center px-0 mb-2">
224224
<div class="avatar me-3">
225-
<img src="{{ url_for('static', path='') }}/img/ivana-square.jpg" alt="kal" class="border-radius-lg shadow">
225+
<img src="{{ url_for('static', path='img/ivana-square.jpg') }}" alt="kal" class="border-radius-lg shadow">
226226
</div>
227227
<div class="d-flex align-items-start flex-column justify-content-center">
228228
<h6 class="mb-0 text-sm">Ivanna</h6>
@@ -232,7 +232,7 @@ <h6 class="mb-0 text-sm">Ivanna</h6>
232232
</li>
233233
<li class="list-group-item border-0 d-flex align-items-center px-0 mb-2">
234234
<div class="avatar me-3">
235-
<img src="{{ url_for('static', path='') }}/img/team-4.jpg" alt="kal" class="border-radius-lg shadow">
235+
<img src="{{ url_for('static', path='img/team-4.jpg') }}" alt="kal" class="border-radius-lg shadow">
236236
</div>
237237
<div class="d-flex align-items-start flex-column justify-content-center">
238238
<h6 class="mb-0 text-sm">Peterson</h6>
@@ -242,7 +242,7 @@ <h6 class="mb-0 text-sm">Peterson</h6>
242242
</li>
243243
<li class="list-group-item border-0 d-flex align-items-center px-0">
244244
<div class="avatar me-3">
245-
<img src="{{ url_for('static', path='') }}/img/team-3.jpg" alt="kal" class="border-radius-lg shadow">
245+
<img src="{{ url_for('static', path='img/team-3.jpg') }}" alt="kal" class="border-radius-lg shadow">
246246
</div>
247247
<div class="d-flex align-items-start flex-column justify-content-center">
248248
<h6 class="mb-0 text-sm">Nick Daniel</h6>
@@ -266,7 +266,7 @@ <h6 class="mb-1">Projects</h6>
266266
<div class="card card-blog card-plain">
267267
<div class="position-relative">
268268
<a class="d-block shadow-xl border-radius-xl">
269-
<img src="{{ url_for('static', path='') }}/img/home-decor-1.jpg" alt="img-blur-shadow" class="img-fluid shadow border-radius-xl">
269+
<img src="{{ url_for('static', path='img/home-decor-1.jpg') }}" alt="img-blur-shadow" class="img-fluid shadow border-radius-xl">
270270
</a>
271271
</div>
272272
<div class="card-body px-1 pb-0">
@@ -283,16 +283,16 @@ <h5>
283283
<button type="button" class="btn btn-outline-primary btn-sm mb-0">View Project</button>
284284
<div class="avatar-group mt-2">
285285
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Elena Morison">
286-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-1.jpg">
286+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-1.jpg') }}">
287287
</a>
288288
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Ryan Milly">
289-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-2.jpg">
289+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-2.jpg') }}">
290290
</a>
291291
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Nick Daniel">
292-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-3.jpg">
292+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-3.jpg') }}">
293293
</a>
294294
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Peterson">
295-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-4.jpg">
295+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-4.jpg') }}">
296296
</a>
297297
</div>
298298
</div>
@@ -303,7 +303,7 @@ <h5>
303303
<div class="card card-blog card-plain">
304304
<div class="position-relative">
305305
<a class="d-block shadow-xl border-radius-xl">
306-
<img src="{{ url_for('static', path='') }}/img/home-decor-2.jpg" alt="img-blur-shadow" class="img-fluid shadow border-radius-lg">
306+
<img src="{{ url_for('static', path='img/home-decor-2.jpg') }}" alt="img-blur-shadow" class="img-fluid shadow border-radius-lg">
307307
</a>
308308
</div>
309309
<div class="card-body px-1 pb-0">
@@ -320,16 +320,16 @@ <h5>
320320
<button type="button" class="btn btn-outline-primary btn-sm mb-0">View Project</button>
321321
<div class="avatar-group mt-2">
322322
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Nick Daniel">
323-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-3.jpg">
323+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-3.jpg') }}">
324324
</a>
325325
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Peterson">
326-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-4.jpg">
326+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-4.jpg') }}">
327327
</a>
328328
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Elena Morison">
329-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-1.jpg">
329+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-1.jpg') }}">
330330
</a>
331331
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Ryan Milly">
332-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-2.jpg">
332+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-2.jpg') }}">
333333
</a>
334334
</div>
335335
</div>
@@ -340,7 +340,7 @@ <h5>
340340
<div class="card card-blog card-plain">
341341
<div class="position-relative">
342342
<a class="d-block shadow-xl border-radius-xl">
343-
<img src="{{ url_for('static', path='') }}/img/home-decor-3.jpg" alt="img-blur-shadow" class="img-fluid shadow border-radius-xl">
343+
<img src="{{ url_for('static', path='img/home-decor-3.jpg') }}" alt="img-blur-shadow" class="img-fluid shadow border-radius-xl">
344344
</a>
345345
</div>
346346
<div class="card-body px-1 pb-0">
@@ -357,16 +357,16 @@ <h5>
357357
<button type="button" class="btn btn-outline-primary btn-sm mb-0">View Project</button>
358358
<div class="avatar-group mt-2">
359359
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Peterson">
360-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-4.jpg">
360+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-4.jpg') }}">
361361
</a>
362362
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Nick Daniel">
363-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-3.jpg">
363+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-3.jpg') }}">
364364
</a>
365365
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Ryan Milly">
366-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-2.jpg">
366+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-2.jpg') }}">
367367
</a>
368368
<a href="javascript:;" class="avatar avatar-xs rounded-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Elena Morison">
369-
<img alt="Image placeholder" src="{{ url_for('static', path='') }}/img/team-1.jpg">
369+
<img alt="Image placeholder" src="{{ url_for('static', path='img/team-1.jpg') }}">
370370
</a>
371371
</div>
372372
</div>

0 commit comments

Comments
 (0)