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'))
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'))
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))
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"))
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'))
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"))
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'))