Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
#26 로그인안하면 릴리즈유저의 페이지를 보여주도록 했습니다. #21 구분하기 쉽게 성, 이름으로 바꿨습니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmg7173 committed Mar 1, 2016
1 parent 587e2dd commit 19089c5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 46 deletions.
18 changes: 4 additions & 14 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import (
Flask,
render_template,
redirect,
)

import config
Expand All @@ -17,6 +17,7 @@
get_logged_in_username,
)
from url import add_routes as add_url_routes
from url import goto

app = Flask(__name__)

Expand All @@ -33,23 +34,12 @@
add_url_routes(app)


# TODO : 릴리즈페이지를 보여주도록 수정!
@app.route("/")
def index():
perhaps_logged_in_username = get_logged_in_username(is_boolean=False)
if perhaps_logged_in_username:
return render_template(
"main.html",
naeyoung='',
loggedin=True,
username=perhaps_logged_in_username,
)
return render_template(
"main.html",
naeyoung='로그인안하셨어요 /login 가 보세요',
loggedin=False,
)

return redirect("/%s/" % perhaps_logged_in_username)
return goto("release")

if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0")
1 change: 0 additions & 1 deletion photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
request,
redirect,
send_from_directory,
url_for,
render_template,
)

Expand Down
2 changes: 1 addition & 1 deletion templates/_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</a>
<br><!-- REALLY?!-->
<h1>
{{ user.first_name_kr }}{{ user.last_name_kr }}
{{ user.last_name_kr }}{{ user.first_name_kr }}
</h1>
<!-- Where is H2 -->
<h3>
Expand Down
4 changes: 2 additions & 2 deletions templates/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
ID: <input type=text class='usr' id=usr name=usr maxlength="50" /><br>
PW: <input type=password class='pwd' id=pwd name=pwd /><br>
PW Again: <input type=password class='pwda' id=pwda name=pwda /><br>
First Name(KO): <input type=text class='fnk' id=fnk name=fnk maxlength="50"/><br>
Last Name(KO): <input type=text class='lnk' id=lnk name=lnk maxlength="50"/><br>
(KO): <input type=text class='lnk' id=lnk name=lnk maxlength="50"/><br>
이름(KO): <input type=text class='fnk' id=fnk name=fnk maxlength="50"/><br>
First Name(EN): <input type=text class='fne' id=fne name=fne maxlength="50" /><br>
Middle Name(EN): <input type=text class='mne' id=mne name=mne maxlength="50" /><br>
Last Name(EN): <input type=text class='lne' id=lne name=lne maxlength="50" /><br>
Expand Down
1 change: 0 additions & 1 deletion url.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
url_for,
request,
redirect,
session,
)

from db import (
Expand Down
34 changes: 7 additions & 27 deletions user.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,16 @@ def register():
db.session.commit()

# TODO: Oh... God...
addURL('%s %s' % (first_name_kr, last_name_kr), username)
addURL('%s %s' % (last_name_kr, first_name_kr), username)
addURL('%s%s' % (first_name_kr, last_name_kr), username)
addURL('%s%s' % (last_name_kr, first_name_kr), username)
addURL('%s %s' % (first_name_en, last_name_en), username)
addURL('%s %s' % (last_name_en, first_name_en), username)
addURL('%s%s' % (first_name_en, last_name_en), username)
addURL('%s%s' % (last_name_en, first_name_en), username)
addURL('%s %s %s' % (first_name_en, middle_name_en, last_name_en), username)

return """
<html>
<head>
<meta http-equiv="refresh" content="3; url=/"></meta>
</head>
<body>
성공하였습니다! 3초 후에 메인화면으로 갑니다!
</body>
</html>
"""
addURL('%s%s%s' % (
first_name_en,
middle_name_en,
last_name_en
), username)
return redirect("/")


def check_username(username, is_internal=False):
Expand Down Expand Up @@ -152,17 +142,7 @@ def login():
def logout():
"""issue #12 로그아웃"""
session.pop('username', None)
return """
<html>
<head>
<meta http-equiv="refresh" content="2; url=/"></meta>
</head>
<body>
로그아웃 합니다! 2초 후 메인페이지로 이동합니다.
</body>
</html>
"""
# return redirect('/')
return redirect('/')


def get_logged_in_username(is_boolean=False):
Expand Down

0 comments on commit 19089c5

Please sign in to comment.