예제 #1
0
def profile():
    if 'username' in session:
        return render_template('profile.html',
                               crtprof=False,
                               logged_in=True,
                               username=user,
                               deets=database.getuser(session['username']))
    return redirect(url_for('root'))
예제 #2
0
def changepass():
    if 'username' in session:
        if request.form['opswd'] == database.getpassword(session['username']):
            database.resetpassword(session['username'], request.form['pswd'])
        return render_template('profile.html',
                               crtprof=False,
                               logged_in=True,
                               username=session['username'],
                               deets=database.getuser(session['username']))
    return redirect(url_for('root'))
예제 #3
0
def messages():
    if 'user' in session:
        cryptoNum = random.randint(1, 100000)
        users[cryptoNum] = session['user']
        return render_template('messagesList.html',
                               num=cryptoNum,
                               crtprof=False,
                               logged_in=True,
                               username=user,
                               deets=database.getuser(user))
예제 #4
0
def messages():
    if 'username' in session:
        userId = database.getuserid(session['username'])[0]
        return render_template('messagesList.html',
                               crtprof=False,
                               logged_in=True,
                               username=session['username'],
                               deets=database.getuser(session['username']),
                               id=userId,
                               myEmail=session['username'])
    return redirect(url_for("root"))
예제 #5
0
def editprof():
    if user in session:
        file = request.files['profile']
        if file:
            filename = secure_filename(file.filename)
            filename = user.replace('.', '-').replace('@', '-') + '.jpeg'
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
        database.edituser(request.form["name"], request.form["email"],
                          request.form["pos"], request.form["major"],
                          request.form["interests"], request.form["bio"], user)
        return render_template('profile.html',
                               crtprof=False,
                               logged_in=True,
                               username=user,
                               deets=database.getuser(user))
    return redirect(url_for('root'))
예제 #6
0
def messageOne(id):
    if 'username' in session:
        cryptoNum = random.randint(1, 100000)
        userId = database.getuserid(session['username'])[0]
        friend = database.getuserbyid(id)
        print(friend)
        users[cryptoNum] = session['username']
        return render_template('message.html',
                               num=cryptoNum,
                               crtprof=False,
                               logged_in=True,
                               username=session['username'],
                               deets=database.getuser(session['username']),
                               id=userId,
                               convouser=friend[1],
                               convoNum=id,
                               myEmail=session['username'],
                               convoEmail=database.getuserbyid(int(id))[2])
    return redirect(url_for("root"))
예제 #7
0
def editprof():
    if 'username' in session:
        file = request.files['profile']
        if file:
            filename = secure_filename(file.filename)
            filename = session['username'].replace('.', '-').replace(
                '@', '-') + '.jpeg'
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
        str = ""
        for i in request.form.getlist("interests"):
            str += i + ","
        database.fillqs(session['username'], request.form["bio"],
                        request.form["pos"], request.form["major"], str[:-1])
        database.edituser(request.form["name"], request.form["email"],
                          request.form["pos"], request.form["major"], str[:-1],
                          request.form["bio"], session['username'])
        return render_template('profile.html',
                               crtprof=False,
                               logged_in=True,
                               username=session['username'],
                               deets=database.getuser(session['username']))
    return redirect(url_for('root'))