Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pip3 install -r requirements.txt
sh init_db.sh

# md5sum secret key 초기화 및 django migrate 실행
# super admin 생성(아이디 root, 비밀번호 rootroot로 자동생성됩니다.)
# 초기 super admin 계정 생성(username: root, email: root@pusan.ac.kr, password: rootroot)
sh init_db.sh --migrate

# 프로젝트를 실행합니다. localhost:8080으로 접속할 수 있습니다.
Expand Down
2 changes: 1 addition & 1 deletion backend/deploy/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ n=0
while [ $n -lt 5 ]
do
python3 manage.py migrate --no-input
python manage.py inituser --username=root --password=rootroot --action=create_super_admin &&
python manage.py inituser --username=root --email=root@pusan.ac.kr --password=rootroot --action=create_super_admin &&
echo "from options.options import SysOptions; SysOptions.judge_server_token='$JUDGE_SERVER_TOKEN'" | python manage.py shell &&
echo "from conf.models import JudgeServer; JudgeServer.objects.update(task_number=0)" | python manage.py shell &&
break
Expand Down
2 changes: 1 addition & 1 deletion backend/init_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ if [ "$1" = "--migrate" ]; then
sleep 3
echo `cat /dev/urandom | head -1 | md5sum | head -c 32` > data/config/secret.key
python3 manage.py migrate
python3 manage.py inituser --username root --password rootroot --action create_super_admin
python3 manage.py inituser --username root --email root@pusan.ac.kr --password rootroot --action create_super_admin
fi
2 changes: 1 addition & 1 deletion backend/utils/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_admin(self, email="admin@admin.com", username="admin", password="admi
problem_permission=ProblemPermission.OWN,
login=login)

def create_super_admin(self, email="root@root.com", username="root", password="root1234!", login=True):
def create_super_admin(self, email="root@pusan.ac.kr", username="root", password="root1234!", login=True):
return self.create_user(
email=email,
username=username,
Expand Down
6 changes: 4 additions & 2 deletions backend/utils/management/commands/inituser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ class Command(BaseCommand):

def add_arguments(self, parser):
parser.add_argument("--username", type=str)
parser.add_argument("--email", type=str)
parser.add_argument("--password", type=str)
parser.add_argument("--action", type=str)

def handle(self, *args, **options):
username = options["username"]
email = options.get("email") or username
password = options["password"]
action = options["action"]

Expand All @@ -27,7 +29,7 @@ def handle(self, *args, **options):

user = User.objects.create(
username=username,
email=username,
email=email,
admin_type=AdminType.SUPER_ADMIN,
problem_permission=ProblemPermission.ALL)
user.set_password(password)
Expand All @@ -39,7 +41,7 @@ def handle(self, *args, **options):
self.stdout.write(self.style.SUCCESS("User created"))
elif action == "create_admin":
user = User.objects.create(
username=username, email=username, admin_type=AdminType.ADMIN, problem_permission=ProblemPermission.OWN)
username=username, email=email, admin_type=AdminType.ADMIN, problem_permission=ProblemPermission.OWN)
user.set_password(password)
user.save()
UserProfile.objects.create(user=user)
Expand Down
55 changes: 48 additions & 7 deletions frontend/src/pages/oj/components/NavBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div id="header">
<div id="header" :style="headerStyle">
<Menu
ref="menuRef"
class="header-menu"
Expand Down Expand Up @@ -111,12 +111,14 @@
:width="400"
:styles="{ top: modalStatus.mode === 'login' ? '10%' : '2%' }"
>
<div slot="header" class="modal-title" style="text-align: center">
{{
modalStatus.mode === "login"
? $t("m.LoginModalHeader")
: $t("m.RegisterModalHeader")
}}
<div slot="header" class="modal-title">
<div class="modal-heading">
{{
modalStatus.mode === "login"
? $t("m.LoginModalHeader")
: $t("m.RegisterModalHeader")
}}
</div>
</div>
<component :is="modalStatus.mode" v-if="modalVisible"></component>
<div slot="footer" style="display: none"></div>
Expand All @@ -139,12 +141,18 @@ export default {
mounted() {
this.getProfile()
this.$nextTick(this.initIndicator)
this.syncHeaderScroll()
window.addEventListener("scroll", this.handleWindowScroll, { passive: true })
},
beforeDestroy() {
if (this.communityDropdownTimer) {
clearTimeout(this.communityDropdownTimer)
this.communityDropdownTimer = null
}
window.removeEventListener("scroll", this.handleWindowScroll)
if (this._headerScrollFrame) {
cancelAnimationFrame(this._headerScrollFrame)
}
this.teardownIndicator()
},
data() {
Expand All @@ -157,6 +165,7 @@ export default {
visible: false,
},
indicatorReady: false,
headerOffsetX: 0,
}
},
methods: {
Expand Down Expand Up @@ -192,6 +201,17 @@ export default {
mode: mode,
})
},
handleWindowScroll() {
if (this._headerScrollFrame) return
this._headerScrollFrame = requestAnimationFrame(() => {
this._headerScrollFrame = null
this.syncHeaderScroll()
})
},
syncHeaderScroll() {
this.headerOffsetX = window.pageXOffset || window.scrollX || 0
this.scheduleIndicatorUpdate()
},
initIndicator() {
const menuEl = this.$refs.menuRef && this.$refs.menuRef.$el
if (!menuEl) return
Expand Down Expand Up @@ -335,6 +355,11 @@ export default {
width: this.indicator.width + "px",
}
},
headerStyle() {
return {
transform: `translateX(${-this.headerOffsetX}px)`,
}
},
modalVisible: {
get() {
return this.modalStatus.visible
Expand Down Expand Up @@ -627,6 +652,22 @@ export default {
&-title {
font-size: 18px;
font-weight: 1000;
text-align: center;
}

&-heading {
color: #17193d;
font-size: inherit;
font-weight: inherit;
line-height: inherit;
}

&-subtitle {
margin-top: 6px;
color: #7b8191;
font-size: 12px;
font-weight: 500;
line-height: 1.4;
}
}

Expand Down
Loading