mirror of
https://github.com/capricornxl/ad-password-self-service.git
synced 2025-08-12 01:44:58 +08:00
修复一些BUG
将修改密码的代码逻辑做复用处理,简化代码。
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import time
|
||||
|
||||
from django_redis import get_redis_connection
|
||||
|
||||
@@ -8,11 +9,12 @@ from utils.storage.kvstorage import KvStorage
|
||||
try:
|
||||
redis_conn = get_redis_connection()
|
||||
cache_storage = KvStorage(redis_conn)
|
||||
cache_storage.set('redis_connection', str(datetime.datetime))
|
||||
cache_storage.get('redis_connection')
|
||||
print("Redis连接成功,set/get测试通过,Token缓存将使用Redis处理")
|
||||
cache_storage.set('redis_connection', str(datetime.datetime.now()))
|
||||
redis_get = cache_storage.get('redis_connection')
|
||||
print("Redis连接成功,set/get测试通过--{},Token缓存将使用Redis处理" .format(redis_get))
|
||||
except Exception as e:
|
||||
cache_storage = MemoryStorage()
|
||||
print("Redis无法连接,Token缓存将使用MemoryStorage处理")
|
||||
print("如果确定需要使用Redis作为缓存,请排查Redis配置")
|
||||
print("Exception: {}".format(e))
|
||||
print("如果确定需要使用Redis作为缓存,请排查Redis配置,错误信息如下:")
|
||||
print("Redis Exception: {}".format(e))
|
||||
|
||||
|
@@ -116,6 +116,10 @@ TEMPLATES = [
|
||||
|
||||
WSGI_APPLICATION = 'pwdselfservice.wsgi.application'
|
||||
|
||||
# 514 66050是AD中账号被禁用的特定代码,这个可以在微软官网查到。
|
||||
# 可能不是太准确,如果使用者能确定还有其它状态码,可以自行在此处添加
|
||||
AD_ACCOUNT_DISABLE_CODE = [514, 66050]
|
||||
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
|
@@ -6,7 +6,7 @@ urlpatterns = {
|
||||
path("favicon.ico", RedirectView.as_view(url='static/img/favicon.ico')),
|
||||
path('', resetpwd.views.index, name='index'),
|
||||
path('callbackCheck', resetpwd.views.callback_check, name='callbackCheck'),
|
||||
path('resetPassword', resetpwd.views.reset_pwd_by_ding_callback, name='resetPassword'),
|
||||
path('resetPassword', resetpwd.views.reset_pwd_by_callback, name='resetPassword'),
|
||||
path('unlockAccount', resetpwd.views.unlock_account, name='unlockAccount'),
|
||||
path('messages', resetpwd.views.messages, name='messages'),
|
||||
}
|
||||
|
Reference in New Issue
Block a user