Beispiel #1
0
def studyCompare():
    form = UserForm()
    if request.method == 'GET':
        session['cookie'] = None
        session['__VIEWSTATE'] = None
        session['__EVENTVALIDATION'] = None
        session['headers'] = None
        session['randomNum'] = None

        (session['cookie'],session['__VIEWSTATE'],session['__EVENTVALIDATION']) = auth.init()
        session['headers'] = auth.createHeaders(session['cookie'])
        session['randomNum'] = auth.getImage(session['headers'])

    if form.validate_on_submit() and request.method == 'POST':
        username = form.txtUserName.data
        password = form.txtUserPassword.data
        CheckCode = form.CheckCode.data
        loginResult = auth.login(session.get('__VIEWSTATE'),session.get('__EVENTVALIDATION'),session.get('headers'),username,password,CheckCode)

        if loginResult != 'yes':
            return render_template('login_error.html', loginError = loginResult,before='course')

        plan = auth.studyCompare(session['headers'],loginResult)

        return render_template('studyCompare.html',plan = plan)

    return render_template('query.html',form=form,randomNum=str(session['randomNum']))
Beispiel #2
0
def mask():
    form = UserForm()
    if request.method == 'GET':
        session['cookie'] = None
        session['__VIEWSTATE'] = None
        session['__EVENTVALIDATION'] = None
        session['headers'] = None
        session['randomNum'] = None

        (session['cookie'],session['__VIEWSTATE'],session['__EVENTVALIDATION']) = auth.init()
        session['headers'] = auth.createHeaders(session['cookie'])
        session['randomNum'] = auth.getImage(session['headers'])

    if form.validate_on_submit() and request.method == 'POST':
        username = form.txtUserName.data
        password = form.txtUserPassword.data
        CheckCode = form.CheckCode.data
        loginResult = auth.login(session.get('__VIEWSTATE'),session.get('__EVENTVALIDATION'),session.get('headers'),username,password,CheckCode)

        if loginResult != 'yes':
            return render_template('login_error.html', loginError = loginResult,before='mask')

        (tiaomu2012,tiaomu2013,tiaomu2014,tiaomu2015,userinfo) = auth.getGrade(session['headers'],loginResult)

        return render_template('mask_detail.html',tiaomu2012 = tiaomu2012,tiaomu2013 = tiaomu2013,tiaomu2014 = tiaomu2014,tiaomu2015 = tiaomu2015,userinfo=userinfo)

    return render_template('query.html',form=form,randomNum=str(session['randomNum']))