Skip to content

Commit

Permalink
Merge pull request #7 from krafton-jungle-AEIOU-mini-project/epic/#2-…
Browse files Browse the repository at this point in the history
…letsjo
  • Loading branch information
letsjo authored Apr 5, 2023
2 parents 8230fb2 + 94a2ff7 commit e0c98d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 38 deletions.
18 changes: 16 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,22 @@ def api_join():


@app.route('/detail')
def detailPage():
return render_template('detail.html')
def detail():
if 'Authorization' in session:
token_receive = session['Authorization']
try:
payload = jwt.decode(token_receive, SECRET_KEY,
algorithms=['HS256'])
user_info = db.user.find_one({"id": payload['id']})
return render_template('detail.html', isLogin=True, nickname=user_info["nick"])
except jwt.ExpiredSignatureError:
session.pop('Authorization', None)
return render_template('detail.html', isLogin=False, alert="로그인 시간이 만료되었습니다. 다시 로그인 해주세요.")
except jwt.exceptions.DecodeError:
session.pop('Authorization', None)
return render_template('detail.html', isLogin=False, alert="로그인 정보가 존재하지 않아 로그아웃 되었습니다.")
else:
return render_template('detail.html')


@app.route('/logout')
Expand Down
2 changes: 2 additions & 0 deletions templates/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
pulvinar libero fermentum mi. Lobortis vulputate consectetur suspendisse massa mauris. Lacus odio pretium enim
gravida. Netus sit a, enim enim quam quam egestas arcu.</p>
</div>
{% if isLogin == True %}
<form class="flex w-full gap-x-4 my-5">
<input id="email-address" name="question" type="text" autocomplete="false" required
class="flex-auto rounded-md border-0 bg-white/5 px-3.5 py-2 text-zinc shadow-sm ring-1 ring-inset ring-black/10 focus:ring-2 focus:ring-inset focus:ring-zinc-500 sm:text-sm sm:leading-6"
placeholder="답변을 도와주세요! ChatGPT 친구가 정확하지 않아요!">
<button type="submit"
class="flex-none rounded-md bg-zinc-500 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-zinc-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-500">답글달기</button>
</form>
{%endif%}
<div class="flex flex-col border-2 border-transparent border-t-gray-200">
<div class="px-8 py-3 space-y-4 border-2 border-transparent border-b-gray-200">
<p class="text-xl font-bold">홍길동</p>
Expand Down
39 changes: 3 additions & 36 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
{%block content %}

<div class="important flex flex-col w-full items-center pb-32">
{% if isLogin == True %}
<form class="flex w-full gap-x-4 my-5">
<input id="email-address" name="question" type="text" autocomplete="false" required
class="flex-auto rounded-md border-0 bg-white/5 px-3.5 py-2 text-zinc shadow-sm ring-1 ring-inset ring-black/10 focus:ring-2 focus:ring-inset focus:ring-zinc-500 sm:text-sm sm:leading-6"
placeholder="조현오 님 무엇이 궁금하신가요?">
placeholder="{{nickname}} 님 무엇이 궁금하신가요?">
<button type="submit"
class="flex-none rounded-md bg-zinc-500 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-zinc-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-500">질문하기</button>
</form>
{% endif %}

<div class="flex flex-col w-full py-2">
<div class="w-full border-2 border-transparent border-b-gray-300">
Expand All @@ -28,41 +30,6 @@
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
<div class="flex flex-col py-3 border-2 border-transparent border-b-gray-200">
<p class="text-xl px-3">답변대기중</p>
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
<div class="flex flex-col py-3 border-2 border-transparent border-b-gray-200">
<p class="text-xl px-3">답변대기중</p>
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
<div class="flex flex-col py-3 border-2 border-transparent border-b-gray-200">
<p class="text-xl px-3">답변대기중</p>
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
<div class="flex flex-col py-3 border-2 border-transparent border-b-gray-200">
<p class="text-xl px-3">답변대기중</p>
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
<div class="flex flex-col py-3 border-2 border-transparent border-b-gray-200">
<p class="text-xl px-3">답변대기중</p>
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
<div class="flex flex-col py-3 border-2 border-transparent border-b-gray-200">
<p class="text-xl px-3">답변대기중</p>
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
<div class="flex flex-col py-3 border-2 border-transparent border-b-gray-200">
<p class="text-xl px-3">답변대기중</p>
<p class="text-xl font-bold px-3 pt-1">스택 큐 알고리즘에 대해서 알려줄 수 있나요?</p>
<p class="text-sm px-3 pt-1">2023. 04. 04</p>
</div>
</div>
</div>

Expand Down

0 comments on commit e0c98d2

Please sign in to comment.