优化实名认证逻辑

dependabot/pip/fir_ser/django-3.2.4
youngS 4 years ago
parent a59958e1af
commit ed841bc8fb
  1. 1
      fir_admin/src/views/appinfos/list.vue
  2. 2
      fir_admin/src/views/storage/list.vue
  3. 4
      fir_admin/src/views/supersign/developer/list.vue
  4. 3
      fir_admin/src/views/supersign/devices/list.vue
  5. 17
      fir_admin/src/views/userinfos/list.vue
  6. 2
      fir_client/src/components/user/FirSuperSignBase.vue
  7. 38
      fir_client/src/components/user/FirUserProfileCertification.vue
  8. 2
      fir_ser/admin/urls.py
  9. 3
      fir_ser/admin/views/storage.py
  10. 17
      fir_ser/api/utils/serializer.py
  11. 21
      fir_ser/api/views/login.py

@ -189,6 +189,7 @@ export default {
}
},
created() {
this.listQuery.user_id = this.$route.params && this.$route.params.user_id
this.fetchData()
},
methods: {

@ -167,7 +167,6 @@ export default {
access_key: undefined,
storage_type: undefined,
domain_name: undefined,
user_id: undefined,
used_id: undefined
},
sortOptions,
@ -175,6 +174,7 @@ export default {
}
},
created() {
this.listQuery.user_id = this.$route.params && this.$route.params.user_id
this.fetchData()
}, mounted() {
if (this.$route.query.user_id) {

@ -59,7 +59,9 @@
</el-table-column>
<el-table-column label="消耗设备数" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.use_number }}
<router-link :to="{name: 'devices_info_list',params:{issuer_id:scope.row.issuer_id}}">
<el-link type="primary"> {{ scope.row.use_number }}</el-link>
</router-link>
</template>
</el-table-column>

@ -170,6 +170,8 @@ export default {
}
},
created() {
this.listQuery.issuer_id = this.$route.params && this.$route.params.issuer_id
this.listQuery.user_id = this.$route.params && this.$route.params.user_id
this.fetchData()
},
methods: {
@ -178,6 +180,7 @@ export default {
this.fetchData()
},
fetchData() {
console.log(this.listQuery)
this.listLoading = true
getDevicesInfo(this.listQuery).then(response => {
this.list = response.data

@ -60,6 +60,13 @@
{{ scope.row.download_times }}
</template>
</el-table-column>
<el-table-column label="应用数量" width="100" align="center">
<template slot-scope="scope">
<router-link :to="{name: 'app_info_list',params:{user_id:scope.row.id}}">
<el-link type="primary"> {{ scope.row.app_count }}</el-link>
</router-link>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="是否激活" width="80" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.is_active | statusFilter">{{ scope.row.is_active }}</el-tag>
@ -68,13 +75,19 @@
<el-table-column class-name="status-col" label="私有存储" width="80" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.storage_active | statusFilter">{{ scope.row.storage_active }}</el-tag>
<router-link v-if="scope.row.storage_active" :to="{name: 'storage_info_list',params:{user_id:scope.row.id}}">
<el-link type="primary"> <el-tag :type="scope.row.storage_active | statusFilter">{{ scope.row.storage_active }}</el-tag></el-link>
</router-link>
<el-tag v-else :type="scope.row.storage_active | statusFilter">{{ scope.row.storage_active }}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="超级签" width="80" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.supersign_active | statusFilter">{{ scope.row.supersign_active }}</el-tag>
<router-link v-if="scope.row.supersign_active" :to="{name: 'devices_info_list',params:{user_id:scope.row.id}}">
<el-link type="primary"> <el-tag :type="scope.row.supersign_active | statusFilter">{{ scope.row.supersign_active }}</el-tag></el-link>
</router-link>
<el-tag v-else :type="scope.row.supersign_active | statusFilter">{{ scope.row.supersign_active }}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="实名认证" width="95" align="center">

@ -489,7 +489,7 @@
},
canceledit() {
this.dialogaddDeveloperVisible = false;
this.editdeveloperinfo = {auth_type: 0,usable_number:100};
this.editdeveloperinfo = {auth_type: 0, usable_number: 100};
this.isedit = false;
this.placeholder = ""
},

@ -269,13 +269,17 @@
return false;
}
}
delete this.form['email'];
this.get_user_certification({methods: 'POST', data: this.form})
},
get_user_certification(params) {
user_certification(res => {
if (res.code === 1000) {
if (params.methods === 'POST') {
this.$message.success("信息提交成功,正在审核中")
this.$message.success("信息提交成功,正在审核中");
this.cert_edit_flag = false;
this.certification_status = 0;
this.get_user_certification({methods: 'GET', data: {act: 'usercert'}});
}
if (res.data.usercert) {
this.certification = res.data.usercert;
@ -302,28 +306,30 @@
"authcode": this.form.authcode,
"cptch_key": this.cptch.cptch_key,
};
if (!this.form.authcode) {
this.$message.error("图片验证码输入有误");
return;
}
let cptch_flag = this.form.authcode.length === this.cptch.length;
if (this.cptch.cptch_key === '' || !this.cptch.cptch_key) {
cptch_flag = true
}
if (cptch_flag) {
let checkp = checkphone(this.form.mobile);
if (!checkp) {
this.$message.error("手机号输入有误");
if (this.cptch.cptch_image) {
if (!this.form.authcode) {
this.$message.error("图片验证码输入有误");
return;
}
let cptch_flag = this.form.authcode.length === this.cptch.length;
if (this.cptch.cptch_key === '' || !this.cptch.cptch_key) {
cptch_flag = true
}
if (!cptch_flag) {
this.$message.error("图片验证码输入有误");
return
}
}
} else {
this.$message.error("图片验证码输入有误");
let checkp = checkphone(this.form.mobile);
if (!checkp) {
this.$message.error("手机号输入有误");
return
}
let params = {'act': act, 'target': target, 'ext': picode, 'user_id': target, 'ftype': 'certification'};
this.form.email = this.form.mobile;
if (this.cptch.geetest) {
this.form.email = this.form.mobile;
geetest(this, params, (n_params) => {
this.get_phone_code(n_params);
})

@ -19,7 +19,7 @@ from admin.views.user import UserInfoView, UserCertificationInfoView
from admin.views.app import AppInfoView, AppReleaseInfoView
from admin.views.storage import StorageInfoView, StorageChangeView
from admin.views.order import OrderPayView, OrderInfoView
from admin.views.supersign import DeveloperInfoView,DevicesInfoView
from admin.views.supersign import DeveloperInfoView, DevicesInfoView
urlpatterns = [
# path("",include(router.urls)),

@ -49,8 +49,9 @@ class StorageInfoView(APIView):
view=self)
serializer = AdminStorageSerializer(page_serializer, many=True)
res.data = serializer.data
res.storage_selection = format_storage_selection(serializer.data, serializer.data[0].get('storage_choices'))
res.total = obj_list.count()
if res.total:
res.storage_selection = format_storage_selection(serializer.data, serializer.data[0].get('storage_choices'))
return Response(res.dict)
def put(self, request):

@ -92,7 +92,7 @@ class AdminUserInfoSerializer(UserInfoSerializer):
read_only_fields = ["id", "head_img", "free_download_times", "last_login",
"is_superuser", "last_name", "is_staff", "uid", "storage_active", "supersign_active",
"date_joined", "download_times", "all_download_times", "storage", "groups",
"user_permissions", "certification_id"]
"user_permissions", "certification_id", " app_count"]
gender_choices = serializers.SerializerMethodField()
@ -119,6 +119,11 @@ class AdminUserInfoSerializer(UserInfoSerializer):
def get_certification_id(self, obj):
return models.UserCertificationInfo.objects.filter(user_id=obj).values('id').first()
app_count = serializers.SerializerMethodField()
def get_app_count(self, obj):
return models.Apps.objects.filter(user_id=obj).count()
def update(self, instance, validated_data):
return super(AdminUserInfoSerializer, self).update(instance, validated_data)
@ -407,17 +412,19 @@ class DeveloperSerializer(serializers.ModelSerializer):
def get_developer_used_other_number(self, obj):
return get_developer_udided(obj)[0]
class AdminDeveloperSerializer(DeveloperSerializer):
class AdminDeveloperSerializer(DeveloperSerializer):
class Meta:
model = models.AppIOSDeveloperInfo
# depth = 1
exclude = [ "p8key",]
exclude = ["p8key", ]
auth_type_choices = serializers.SerializerMethodField()
def get_auth_type_choices(self, obj):
return get_choices_dict(obj.auth_type_choices)
class SuperSignUsedSerializer(serializers.ModelSerializer):
class Meta:
model = models.APPSuperSignUsedInfo
@ -448,7 +455,8 @@ class SuperSignUsedSerializer(serializers.ModelSerializer):
class AdminSuperSignUsedSerializer(SuperSignUsedSerializer):
class Meta:
model = models.APPSuperSignUsedInfo
fields = ["created_time", "device_udid", "device_name", "developer_id", "bundle_id", "bundle_name","app_id","id","user_id","short","developer_pk"]
fields = ["created_time", "device_udid", "device_name", "developer_id", "bundle_id", "bundle_name", "app_id",
"id", "user_id", "short", "developer_pk"]
app_id = serializers.SerializerMethodField()
@ -470,6 +478,7 @@ class AdminSuperSignUsedSerializer(SuperSignUsedSerializer):
def get_developer_pk(self, obj):
return obj.developerid.pk
class DeviceUDIDSerializer(serializers.ModelSerializer):
class Meta:
model = models.AppUDID

@ -642,11 +642,18 @@ class CertificationView(APIView):
if CHANGER.get('change_type').get('sms'):
is_valid, target = is_valid_sender_code('sms', data.get("auth_token", None), data.get("auth_key", None))
if is_valid and str(target) == str(data.get("mobile")):
if login_auth_failed("get", data.get("mobile")):
if login_auth_failed("get", str(data.get("mobile"))):
del data["auth_key"]
del data["auth_token"]
UserCertificationInfo.objects.update_or_create(user_id=request.user, status=0, defaults=data)
return self.get(request)
data['status'] = 0
if CertificationInfo.objects.filter(user_id=request.user).count() == 3:
UserCertificationInfo.objects.update_or_create(defaults=data, user_id=request.user)
return self.get(request)
else:
res.code = 1009
res.msg = "请上传照片"
return Response(res.dict)
else:
res.code = 1006
logger.error("username:%s failed too try , locked" % (request.user,))
@ -655,7 +662,13 @@ class CertificationView(APIView):
res.code = 1001
res.msg = "短信验证码有误"
else:
UserCertificationInfo.objects.update_or_create(user_id=request.user, status=0, defaults=data)
data['status'] = 0
if CertificationInfo.objects.filter(user_id=request.user).count() == 3:
UserCertificationInfo.objects.update_or_create(defaults=data, user_id=request.user)
else:
res.code = 1009
res.msg = "请上传照片"
return Response(res.dict)
return self.get(request)
except Exception as e:
logger.error("%s UserCertificationInfo save %s failed Exception: %s" % (request.user, data, e))

Loading…
Cancel
Save