Esempio n. 1
0
def serveIndex(request, force_mcf=None):
    currentuser = getCurrentUser(request)
    mcf = 'dashboard'
    params = ''
    if currentuser.is_authenticated():
        #only clear if we were logged in.
        urlstate = getCurrentURLState(request, andClear=True)
    else:
        urlstate = getCurrentURLState(request)

    if force_mcf:
        mcf = force_mcf
    elif urlstate.redirectMainContentFunction:
        mcf = urlstate.redirectMainContentFunction
    if urlstate.params:
        params = urlstate.params

    if params:
        sendparams = params[1]
    else:
        sendparams = ''

    jsonparams = simplejson.dumps(sendparams)

    return render_to_response('index.html', {
                        'APP_SECURE_URL': siteurl(request),
                        'user': request.user,
                        'mainContentFunction': mcf,
                        'wh': webhelpers,
                        'params': jsonparams,
                        }, context_instance=RequestContext(request))
Esempio n. 2
0
def serveIndex(request, force_mcf=None):
    currentuser = getCurrentUser(request)
    mcf = 'dashboard'
    params = ''
    if currentuser.is_authenticated():
        #only clear if we were logged in.
        urlstate = getCurrentURLState(request, andClear=True)
    else:
        urlstate = getCurrentURLState(request)

    if force_mcf:
        mcf = force_mcf
    elif urlstate.redirectMainContentFunction:
        mcf = urlstate.redirectMainContentFunction
    if urlstate.params:
        params = urlstate.params

    if params:
        sendparams = params[1]
    else:
        sendparams = ''

    jsonparams = json.dumps(sendparams)

    return render_to_response('index.html', {
        'APP_SECURE_URL': siteurl(request),
        'user': request.user,
        'mainContentFunction': mcf,
        'wh': webhelpers,
        'params': jsonparams,
    },
                              context_instance=RequestContext(request))
Esempio n. 3
0
def populateResetPasswordForm(request, *args):
    u = request.user
    data = {}
    urlstate = getCurrentURLState(request, andClear=True)
    data['email'] = urlstate.resetPasswordEmail
    data['validationKey'] = urlstate.resetPasswordValidationKey
    return jsonResponse(items=[data])
Esempio n. 4
0
def populateResetPasswordForm(request, *args):
    u = request.user
    data = {}
    urlstate = getCurrentURLState(request, andClear=True)
    data['email'] = urlstate.resetPasswordEmail
    data['validationKey'] = urlstate.resetPasswordValidationKey
    return jsonResponse(items=[data])
Esempio n. 5
0
def viewFormalRedirect(request, *args):
    urlstate = getCurrentURLState(request)
    urlstate.redirectMainContentFunction = 'quote:viewformal'
    urlstate.params = [
        'quote:viewformal', {
            'qid': int(request.REQUEST.get('quoterequestid', 0))
        }
    ]
    return HttpResponseRedirect(siteurl(request))
Esempio n. 6
0
def forgotPasswordRedirect(request, *args):
    u = request.user
    try:
        urlstate = getCurrentURLState(request)
        urlstate.redirectMainContentFunction = 'login:resetpassword'
        urlstate.resetPasswordEmail = request.REQUEST['em']
        urlstate.resetPasswordValidationKey = request.REQUEST['vk']
        return HttpResponseRedirect(siteurl(request))
    except Exception, e:
        logger.warning('Exception in forgot password redirect: %s' % (str(e)))
Esempio n. 7
0
def forgotPasswordRedirect(request, *args):
    u = request.user
    try:
        urlstate = getCurrentURLState(request)
        urlstate.redirectMainContentFunction = 'login:resetpassword'
        urlstate.resetPasswordEmail = request.REQUEST['em']
        urlstate.resetPasswordValidationKey = request.REQUEST['vk']
        return HttpResponseRedirect(siteurl(request))
    except Exception, e:
        logger.warning('Exception in forgot password redirect: %s' % (str(e)))
Esempio n. 8
0
def viewFormalRedirect(request, *args):
    urlstate = getCurrentURLState(request)
    urlstate.redirectMainContentFunction = 'quote:viewformal'
    urlstate.params = ['quote:viewformal', {'qid':int(request.REQUEST.get('quoterequestid', 0))}]
    return HttpResponseRedirect(siteurl(request))