Skip to content

Commit 3450a37

Browse files
lijianguoduanhongyi
authored andcommitted
chore(passport): modify web stylesheet
1 parent 50576b1 commit 3450a37

21 files changed

Lines changed: 2841 additions & 8516 deletions

charts/passport/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ database_url: ""
1212
# can be specified as key-value pairs under environment
1313
# this is usually a non required setting.
1414
environment:
15-
RESERVED_NAMES: "drycc, drycc-builder, drycc-monitor-grafana"
1615
## LDAP setting
1716
# LDAP_ENDPOINT: ""
1817
# LDAP_BIND_DN: ""

rootfs/api/serializers.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
"""
44
import logging
55

6-
from django.contrib.auth.models import User
76
from django.contrib.admin.models import LogEntry
87
from django.contrib.auth.forms import UserCreationForm
9-
from rest_framework import serializers
10-
from oauth2_provider.oauth2_validators import OAuth2Validator
8+
from django.contrib.auth.models import User
119
from oauth2_provider.models import Grant, AccessToken
10+
from oauth2_provider.oauth2_validators import OAuth2Validator
11+
from rest_framework import serializers
1212

13+
from api.exceptions import DryccException
1314
from api.utils import timestamp2datetime
1415

1516
logger = logging.getLogger(__name__)
@@ -32,6 +33,10 @@ class Meta:
3233

3334
def update(self, instance, validated_data):
3435
if validated_data.get('username'):
36+
qs = User.objects.filter(username=validated_data.get('username')).\
37+
exclude(username=instance.username)
38+
if qs:
39+
raise DryccException("new username already exists.")
3540
instance.username = validated_data.get('username')
3641
if validated_data.get('email'):
3742
instance.email = validated_data.get('email')

rootfs/api/settings/production.py

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
https://docs.djangoproject.com/en/2.2/ref/settings/
88
"""
99
import os.path
10-
import tempfile
1110
import ldap
1211
import dj_database_url
1312

@@ -103,7 +102,6 @@
103102
'guardian',
104103
'gunicorn',
105104
'rest_framework',
106-
'rest_framework.authtoken',
107105
'oauth2_provider',
108106
# passport apps
109107
'api'
@@ -149,13 +147,12 @@
149147
)
150148

151149
X_FRAME_OPTIONS = 'DENY'
152-
# todo debug oauth2
153-
# CSRF_COOKIE_SECURE = True
154150
CSRF_COOKIE_HTTPONLY = False
155151
CSRF_COOKIE_SAMESITE = None
156-
# SESSION_COOKIE_SECURE = True
157152
SECURE_CONTENT_TYPE_NOSNIFF = True
158153
SECURE_BROWSER_XSS_FILTER = True
154+
CSRF_COOKIE_SECURE = bool(os.environ.get('CSRF_COOKIE_SECURE', False))
155+
SESSION_COOKIE_SECURE = bool(os.environ.get('SESSION_COOKIE_SECURE', False))
159156

160157
# Honor HTTPS from a trusted proxy
161158
# see https://docs.djangoproject.com/en/2.2/ref/settings/#secure-proxy-ssl-header
@@ -249,16 +246,6 @@
249246
},
250247
}
251248
}
252-
# TEST_RUNNER = 'api.tests.SilentDjangoTestSuiteRunner'
253-
254-
# default drycc passport settings
255-
LOG_LINES = 100
256-
TEMPDIR = tempfile.mkdtemp(prefix='drycc')
257-
258-
# names which apps cannot reserve for routing
259-
DRYCC_RESERVED_NAMES = os.environ.get('RESERVED_NAMES', '').\
260-
replace(' ', '').split(',')
261-
262249
# security keys and auth tokens
263250
random_secret = ')u_jckp95wule8#wxd8sm!0tj2j&aveozu!nnpgl)2x&&16gfj'
264251
SECRET_KEY = os.environ.get('DRYCC_SECRET_KEY', random_secret)
@@ -270,23 +257,6 @@
270257
conn_max_age=600)
271258
}
272259

273-
# Redis Configuration
274-
DRYCC_REDIS_ADDRS = os.environ.get('DRYCC_REDIS_ADDRS', '127.0.0.1:6379').split(
275-
",")
276-
DRYCC_REDIS_PASSWORD = os.environ.get('DRYCC_REDIS_PASSWORD', '')
277-
278-
# Cache Configuration
279-
CACHES = {
280-
"default": {
281-
"BACKEND": "django_redis.cache.RedisCache",
282-
"LOCATION": ['redis://:{}@{}'.format(DRYCC_REDIS_PASSWORD, DRYCC_REDIS_ADDR) \
283-
for DRYCC_REDIS_ADDR in DRYCC_REDIS_ADDRS], # noqa
284-
"OPTIONS": {
285-
"CLIENT_CLASS": "django_redis.client.ShardClient",
286-
}
287-
}
288-
}
289-
290260
# LDAP settings taken from environment variables.
291261
LDAP_ENDPOINT = os.environ.get('LDAP_ENDPOINT', '')
292262
LDAP_BIND_DN = os.environ.get('LDAP_BIND_DN', '')

rootfs/api/templates/user/password_change_done.html

Lines changed: 0 additions & 5 deletions
This file was deleted.

rootfs/api/templates/user/password_change_form.html

Lines changed: 0 additions & 52 deletions
This file was deleted.

rootfs/api/urls.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@
3232
re_path(r'reset/done/?$',
3333
views.UserPasswordResetCompleteView.as_view(),
3434
name='user_password_reset_complete'),
35-
re_path(r'password_change/?$', views.UserPasswordChangeView.as_view(),
36-
name='user_password_change'),
37-
re_path(r'password_change/done/?$',
38-
views.UserPasswordchangeDoneView.as_view(),
39-
name='user_password_change_done'),
40-
4135
re_path(r'login/?$', views.UserLoginView.as_view(), name='user_login'),
4236
re_path(r'login/done/?$', LoginDoneView.as_view(), name='login_done'),
4337
re_path(r'logout/?$', views.UserLogoutView.as_view(), name='user_logout'),

rootfs/api/views.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,6 @@ class UserPasswordResetCompleteView(views.PasswordResetCompleteView):
182182
template_name = 'user/password_reset_complete.html'
183183

184184

185-
class UserPasswordChangeView(views.PasswordChangeView):
186-
success_url = reverse_lazy('user_password_change_done')
187-
template_name = 'user/password_change_form.html'
188-
189-
190-
class UserPasswordchangeDoneView(views.PasswordChangeDoneView):
191-
template_name = 'user/password_change_done.html'
192-
193-
194185
class UserLogoutView(views.LogoutView):
195186
template_name = 'user/logout.html'
196187

0 commit comments

Comments
 (0)