Esempio n. 1
0
def change_passwd(req):
    if req.method == 'POST' and req.user.is_authenticated():
        form = ChangePasswdForm(req.user, req.POST)
        if form.save():
            return render_to_response('change_passwd_success.html', {'settings' : settings}, context_instance=RequestContext(req))
    else:
        form = ChangePasswdForm(req.user)
    return render_to_response('change_passwd.html', {'settings' : settings, 'form': form}, context_instance=RequestContext(req))
Esempio n. 2
0
def change_passwd(req):
    if req.method == "POST" and req.user.is_authenticated():
        form = ChangePasswdForm(req.user, req.POST)
        if form.save():
            return render_to_response(
                "change_passwd_success.html", {"settings": settings}, context_instance=RequestContext(req)
            )
    else:
        form = ChangePasswdForm(req.user)
    return render_to_response(
        "change_passwd.html", {"settings": settings, "form": form}, context_instance=RequestContext(req)
    )
Esempio n. 3
0
def change_passwd(req):
    if req.method == 'POST' and req.user.is_authenticated():
        form = ChangePasswdForm(req.user, req.POST)
        if form.save():
            return render_to_response('change_passwd_success.html',
                                      {'settings': settings},
                                      context_instance=RequestContext(req))
    else:
        form = ChangePasswdForm(req.user)
    return render_to_response('change_passwd.html', {
        'settings': settings,
        'form': form
    },
                              context_instance=RequestContext(req))
Esempio n. 4
0
def changePasswd(request):
  reponse = dict()
  reponse.update(status = 0, msg = '录入信息错误,请重新录入!')
  if not userApi.checkUserAuth(request):
    reponse.update(msg = '请重新登录系统重试!')
    return HttpResponse(json.dumps(reponse),mimetype='application/json')
    
  msg = ''
  if request.method == 'POST':
    form = ChangePasswdForm(request.POST)
    if form.is_valid():
      if not userApi.authService(form.cleaned_data['userId'], form.cleaned_data['passwd']):
        msg = '密码不正确!'
      else:
        userInfo = userApi.getUserByUserId(form.cleaned_data['userId'])
        userInfo.passwd = form.cleaned_data['repasswd']
        userInfo.put();
        msg = '修改密码成功!'
        reponse.update(status = 1)
  if msg != '':
    reponse.update(msg = msg)
  return HttpResponse(json.dumps(reponse),mimetype='application/json')