Skip to content

Commit

Permalink
update groups 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
RTXUX committed Oct 23, 2024
1 parent 285ac2c commit 69328e8
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 32 deletions.
2 changes: 1 addition & 1 deletion frontend/auth_providers/fdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LoginView(ExternalLoginView):
class GetCodeView(ExternalGetCodeView):
provider = 'fdu'
duration = timedelta(hours=1)
validate_identity = UserRegexAndDomainEmailValidator(['fudan.edu.cn', 'm.fudan.edu.cn'], r'^\d{11}$')
validate_identity = UserRegexAndDomainEmailValidator(['fudan.edu.cn', 'm.fudan.edu.cn'], r'^[a-zA-Z0-9._%+-]+$')


urlpatterns = [
Expand Down
2 changes: 1 addition & 1 deletion frontend/auth_providers/shu.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LoginView(ExternalLoginView):
class GetCodeView(ExternalGetCodeView):
provider = 'shu'
duration = timedelta(hours=1)
validate_identity = UserRegexAndDomainEmailValidator('shu.edu.cn', r'^(?:[a-z]|_|-|\d){3,50}$')
validate_identity = UserRegexAndDomainEmailValidator('shu.edu.cn', r'^[a-z0-9_-]{3,50}$')


urlpatterns = [
Expand Down
24 changes: 24 additions & 0 deletions frontend/auth_providers/sjtu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from datetime import timedelta

from django.urls import path

from .base import UserRegexAndDomainEmailValidator
from .external import ExternalLoginView, ExternalGetCodeView


class LoginView(ExternalLoginView):
template_context = {'provider_name': '上海交通大学'}
provider = 'sjtu'
group = 'sjtu'


class GetCodeView(ExternalGetCodeView):
provider = 'sjtu'
duration = timedelta(hours=1)
validate_identity = UserRegexAndDomainEmailValidator('sjtu.edu.cn', r'^\w+([-+.]\w+)*$')


urlpatterns = [
path('ouc/login/', LoginView.as_view()),
path('ouc/get_code/', GetCodeView.as_view()),
]
4 changes: 2 additions & 2 deletions frontend/auth_providers/xmut.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.urls import path

from .base import DomainEmailValidator
from .base import UserRegexAndDomainEmailValidator
from .external import ExternalLoginView, ExternalGetCodeView


Expand All @@ -15,7 +15,7 @@ class LoginView(ExternalLoginView):
class GetCodeView(ExternalGetCodeView):
provider = 'xmut'
duration = timedelta(hours=1)
validate_identity = DomainEmailValidator(['s.xmut.edu.cn'])
validate_identity = UserRegexAndDomainEmailValidator('s.xmut.edu.cn', r'^[0-9]{9}$')


urlpatterns = [
Expand Down
4 changes: 1 addition & 3 deletions frontend/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ <h2>协办单位选手</h2>
<a class="pure-button" href="/accounts/sysu/login/">中山大学</a>
<a class="pure-button" href="/accounts/xidian/login/">西安电子科技大学</a>
<a class="pure-button" href="/accounts/hit/login/">哈尔滨工业大学</a>
<a class="pure-button" href="/accounts/nudt/login/">国防科技大学</a>
<a class="pure-button" href="/accounts/fdu/login/">复旦大学</a>
<a class="pure-button" href="/accounts/tongji/login/">同济大学</a>
<a class="pure-button" href="/accounts/gdou/login/">广东海洋大学</a>
<a class="pure-button" href="/accounts/gdut/login/">广东工业大学</a>
<a class="pure-button" href="/accounts/gzhu/login/">广州大学</a>
<a class="pure-button" href="/accounts/sustech/login/">南方科技大学</a>
<a class="pure-button" href="/accounts/xmut/login/">厦门理工学院</a>
<a class="pure-button" href="/accounts/shu/login/">上海大学</a>
<a class="pure-button" href="/accounts/nyist/login/">南阳理工学院</a>
<a class="pure-button" href="/accounts/sjtu/login/">上海交通大学</a>
</div>
<h2>其他选手</h2>
<div class="group">
Expand Down
4 changes: 1 addition & 3 deletions frontend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@
path('accounts/', include('frontend.auth_providers.sysu')),
path('accounts/', include('frontend.auth_providers.xidian')),
path('accounts/', include('frontend.auth_providers.hit')),
path('accounts/', include('frontend.auth_providers.nudt')),
path('accounts/', include('frontend.auth_providers.fdu')),
path('accounts/', include('frontend.auth_providers.tongji')),
path('accounts/', include('frontend.auth_providers.gdou')),
path('accounts/', include('frontend.auth_providers.gdut')),
path('accounts/', include('frontend.auth_providers.gzhu')),
path('accounts/', include('frontend.auth_providers.sustech')),
path('accounts/', include('frontend.auth_providers.xmut')),
path('accounts/', include('frontend.auth_providers.shu')),
path('accounts/', include('frontend.auth_providers.nyist')),
path('accounts/', include('frontend.auth_providers.sjtu')),
path('accounts/', include('frontend.auth_providers.sms')),
path('accounts/', include('allauth.socialaccount.providers.google.urls')),
path('accounts/', include('allauth.socialaccount.providers.microsoft.urls')),
Expand Down
34 changes: 15 additions & 19 deletions server/user/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,14 @@ class User:
'sysu': '中山大学',
'xidian': '西安电子科技大学',
'hit': '哈尔滨工业大学',
'nudt': '国防科技大学',
'fdu': '复旦大学',
'tongji': '同济大学',
'gdou': '广东海洋大学',
'gdut': '广东工业大学',
'gzhu': '广州大学',
'sustech': '南方科技大学',
'xmut': '厦门理工学院',
'shu': '上海大学',
'nyist': '南阳理工学院',
'sjtu': '上海交通大学',
'other': '其他选手',
'banned': '已封禁',
}
Expand All @@ -75,23 +73,21 @@ class User:
profile_required = {
'noscore': ['nickname'],
'ustc': ['nickname', 'name', 'sno', 'tel', 'email'],
'zju': ['nickname', 'name', 'sno', 'school', 'campus'],
'jlu': ['nickname', '/name/sno/qq/0'],
'nuaa': ['nickname', 'name', 'sno'],
'neu': ['nickname', 'name', 'sno', 'school'],
'sysu': ['nickname', 'name', 'sno'],
'xidian': ['nickname', 'name', 'sno'],
'hit': ['nickname', 'name', 'sno', 'campus'],
'nudt': ['nickname', 'name', 'email'],
'fdu': ['nickname', 'name', 'sno'],
'tongji': ['nickname', 'name', 'sno', 'school', 'major'],
'gdou': ['nickname', 'name', 'sno'],
'gdut': ['nickname', 'name', 'sno'],
'gzhu': ['nickname', 'name', 'sno'],
'zju': ['nickname', 'name', 'sno', 'qq', 'major'],
'jlu': ['nickname', 'name', 'sno', 'major'],
'nuaa': ['nickname', 'name', 'sno', 'qq'],
'neu': ['nickname', 'name', 'sno', 'school', 'major', 'qq'],
'sysu': ['nickname', 'name', 'sno', 'school', 'major', 'qq'],
'xidian': ['nickname', 'name', 'sno', 'qq', 'major'],
'hit': ['nickname', 'name', 'sno', 'campus', 'school', 'qq'],
'fdu': ['nickname', 'name', 'sno', 'school', 'major'],
'tongji': ['nickname', 'name', 'sno', 'major'],
'gdou': ['nickname', 'name', 'sno', 'school', 'campus', 'major', 'qq'],
'sustech': ['nickname', 'name', 'sno'],
'xmut': ['nickname', 'name', 'sno'],
'shu': ['nickname', 'name', 'sno'],
'nyist': ['nickname', 'name', 'sno'],
'xmut': ['nickname', 'name', 'sno', 'school', 'campus', 'major', 'qq'],
'shu': ['nickname'],
'nyist': ['nickname', 'name', 'sno', 'school', 'major', 'qq'],
'sjtu': ['nickname', 'name', 'sno'],
'other': ['nickname'],
'banned': ['nickname'],
}
Expand Down
17 changes: 17 additions & 0 deletions server/user/migrations/0017_update_groups_2024.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.16 on 2024-10-23 07:45

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('user', '0016_add_nyist'),
]

operations = [
migrations.AlterModelOptions(
name='user',
options={'default_permissions': (), 'permissions': [('full', '管理个人信息'), ('view', '查看个人信息'), ('view_ustc', '查看中国科学技术大学个人信息'), ('view_zju', '查看浙江大学个人信息'), ('view_jlu', '查看吉林大学个人信息'), ('view_nuaa', '查看南京航空航天大学个人信息'), ('view_neu', '查看东北大学个人信息'), ('view_sysu', '查看中山大学个人信息'), ('view_xidian', '查看西安电子科技大学个人信息'), ('view_hit', '查看哈尔滨工业大学个人信息'), ('view_fdu', '查看复旦大学个人信息'), ('view_tongji', '查看同济大学个人信息'), ('view_gdou', '查看广东海洋大学个人信息'), ('view_sustech', '查看南方科技大学个人信息'), ('view_xmut', '查看厦门理工学院个人信息'), ('view_shu', '查看上海大学个人信息'), ('view_nyist', '查看南阳理工学院个人信息'), ('view_sjtu', '查看上海交通大学个人信息')]},
),
]
4 changes: 1 addition & 3 deletions server/user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ class Meta:
('view_sysu', '查看中山大学个人信息'),
('view_xidian', '查看西安电子科技大学个人信息'),
('view_hit', '查看哈尔滨工业大学个人信息'),
('view_nudt', '查看国防科技大学个人信息'),
('view_fdu', '查看复旦大学个人信息'),
('view_tongji', '查看同济大学个人信息'),
('view_gdou', '查看广东海洋大学个人信息'),
('view_gdut', '查看广东工业大学个人信息'),
('view_gzhu', '查看广州大学个人信息'),
('view_sustech', '查看南方科技大学个人信息'),
('view_xmut', '查看厦门理工学院个人信息'),
('view_shu', '查看上海大学个人信息'),
('view_nyist', '查看南阳理工学院个人信息'),
('view_sjtu', '查看上海交通大学个人信息'),
]


Expand Down

0 comments on commit 69328e8

Please sign in to comment.