def securityVerification(request, *args, **kwargs): """If user has passed phone verification, then will do this security verification(send verification number to phone), when do operation such as: change password, update email, update phone number, update payment password.""" initParam = {} user = get_object_or_404(models.User, pk=request.user.id, username=request.user.username) if request.method == "POST": pin = request.POST.get('pin', None) redirect_to = request.POST.get('next') if pin and redirect_to: #TODO:Check whether pin is correct judging with session value. to do it later. return redirect(redirect_to) else: securitySettings = user.securityverification_set.filter( vtype=2, is_verified=True) if securitySettings: initParam['phone_number'] = common.hiddenPhone( securitySettings[0].value) initParam['next'] = kwargs.get('current', None) return render_to_response("usersetting/security_verification.html", initParam, context_instance=RequestContext(request)) saveMethod = kwargs.get('saveMethod', None) if saveMethod: return saveMethod(request, args, kwargs)
def securitySetting(request, *args, **kwargs): """security setting include email, phone""" initParam = {} user = get_object_or_404(models.User, pk=request.user.id, username=request.user.username) securitySettings = user.securityverification_set.all() for securitySetting in securitySettings: if securitySetting.vtype == 1: securitySetting.value = common.hiddenEmail(securitySetting.value) initParam['email_info'] = securitySetting if securitySetting.vtype == 2: securitySetting.value = common.hiddenPhone(securitySetting.value) initParam['phone_info'] = securitySetting return render_to_response("usersetting/security_setting.html", initParam, context_instance=RequestContext(request))
def securityVerification(request, *args, **kwargs): """If user has passed phone verification, then will do this security verification(send verification number to phone), when do operation such as: change password, update email, update phone number, update payment password.""" initParam = {} user = get_object_or_404(models.User, pk=request.user.id, username=request.user.username) if request.method == "POST": pin = request.POST.get('pin', None) redirect_to = request.POST.get('next') if pin and redirect_to: #TODO:Check whether pin is correct judging with session value. to do it later. return redirect(redirect_to) else: securitySettings = user.securityverification_set.filter(vtype=2, is_verified=True) if securitySettings: initParam['phone_number'] = common.hiddenPhone(securitySettings[0].value) initParam['next'] = kwargs.get('current', None) return render_to_response("usersetting/security_verification.html", initParam, context_instance=RequestContext(request)) saveMethod = kwargs.get('saveMethod', None) if saveMethod: return saveMethod(request, args, kwargs)