Commit e067e010 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Updated login procedure.

parent 90b64b29
import re
import urllib
import MySQLdb
import ldap
import site
site.addsitedir('/srv/http/wsgi')
import library
import goconfig
def application(environ, start_response):
# Set default "empty page" text.
body = ["<p>Nothing here.</p>"]
# If the page was requested via POST, that means the URL-input
# form was submitted. Scan over the input data, parse it, validate
# it, and then finally connect to the DB and store it. Then output.
while environ["REQUEST_METHOD"] == "POST":
# Grab user data, cut off non-relevant fields.
data = environ['wsgi.input']
data = library.parse_post_data( data )
library.trim_noise( data, fields )
body = ["Hello, world!"]
# Read and store in memory the header and footer sections
# of the page display.
f = open(goconfig.doc_root + "/site_data/top.part", "r")
top_part = f.read()
f.close()
f = open(goconfig.doc_root + "/site_data/bottom.part", "r")
bottom_part = f.read()
f.close()
# Construct the HTML output using the wrapper and body data.
body = ''.join( body )
response = top_part + body + bottom_part
# Do web-stuff
status = '200 OK'
response_headers = [('Content-type', 'text/html'),
('Content-Length', str(len(response)))]
start_response(status, response_headers)
return [response]
......@@ -10,19 +10,19 @@ doc_root = "/srv/http"
##############################
# MySQL connection variables
# Database connection variables
#
# These variables configure how the website connects
# to the required MySQL database.
# to the required database.
##############################
# sql_domain: The location of the SQL database to connect to.
sql_domain = "localhost"
# sql_usr: The username to use with this database.
# sql_usr: The username to use with this SQL database.
sql_usr = "go-user"
# sql_pasw: The plaintext password used to connec to the database.
# sql_pasw: The plaintext password used to connec to the SQL database.
sql_pasw = "georgemasonsrct"
# sql_db: The SQL database or schema name to which to connect.
......@@ -31,6 +31,9 @@ sql_db = "srctgo"
# sql_table: The SQL table storing the URL listing.
sql_table = "urls"
#ldap_domain: The location of the LDAP database to connect to.
ldap_domain = "ldap://ldap.gmu.edu"
##############################
......
......@@ -35,7 +35,7 @@ def application(environ, start_response):
f.close()
login_form = """
<form action="" method="post">
<form action="/exec/lg" method="post">
<label for="usr">username</label>
<p>Your administrator username (MasonID).</p>
<input type="text" id="usr" name="usr" value="" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment