def login(self, username, password): session = EVCstate(trust=True) db = evec_func.db_con() res = None r = User.login(db, session, username, password) if r is not False: if 'isigb' not in session or not session['isigb']: emit_redirect('/users/index.html') res = "<html><head><title>Logged in</title></head><body>" res += "Logged in! Go to <a href=/users/index.html>user home</a>. You are getting this page because the IGB does not know how to redirect." res += "</body></html>" session['user'] = r else: res = "<html><head><title>Login failed</title></head><body>" res += "Your login failed due to a bad password or username." res += "<form method=GET action=/users/passreset.html>Send a reset email for the user " + username res += " to the email address <input type=text name=uemail> (must match email on file!)" res += "<input type=hidden name=username value=\""+username+"\"><input type=submit value=Send>" res += "</form>" res += "</body></html>" db.close() return res
def register(self, password,email): session = EVCstate(trust=True) charname = None if 'Eve-Charname' in dict(cherrypy.request.headers): charname = cherrypy.request.headers['Eve-Charname'] if charname is None: return evec_func.simple_error("No username found?") if password == "": return evec_func.simple_error("Please specify a password") if '@' not in email: return evec_func.simple_error("Please specify a semi-valid email address") db = evec_func.db_con() password = password.strip() r = User.register(db, password,email) if r is False: db.close() return evec_func.simple_error("Error: Registration error. You may already be registered or the system messed up") User.login(db, session, charname, password) emit_redirect('/users/') return """<html><head><title>Hi</title></head><body>
def setigb(self, isigb="0"): session = EVCstate() if isigb == "1": session['isigb'] = True else: session['isigb'] = False session.save() emit_redirect('/home/')
def setigb(self, isigb="0"): session = EVCstate() if isigb == "1": session["isigb"] = True else: session["isigb"] = False session.save() emit_redirect("/home/")
def changepw(self, oldpw, newpw, newpw2): session = EVCstate(trust=True) db = evec_func.db_con() if newpw != newpw2: return evec_func.simple_error("Passwords do not match") u = User.get(session, db) u.change_pw(db, oldpw,newpw) emit_redirect('/users/') db.close()
def logout(self): session = EVCstate(trust=True) db = evec_func.db_con() try: session['user'] = None del session['user'] except: pass return emit_redirect('/')
def typesearch(self, search): session = EVCstate() t = display.template('typesearch.tmpl', session) t.search = search db = evec_func.db_con() search = search.lower() search = "%" + search + "%" notmask = '%Blueprint' if search.find('blueprint') != -1: notmask = 'this wont ever exist' cur = db.cursor() cur.execute("SELECT typename,typeid FROM types WHERE typename ILIKE %s AND typename NOT ILIKE %s ORDER BY typename", [search, notmask]) types = [] item = cur.fetchone() while item: types.append({'typeid':item[1], 'typename':item[0]}) item = cur.fetchone() t.types = types db.close() if len(types) == 1: emit_redirect('/home/quicklook.html?typeid='+str(int(types[0]['typeid']))) return return t.respond()
def register(self): session = EVCstate(trust=True) db = evec_func.db_con() user = User.get(session, db) if user.valid is False: db.close() return evec_func.simple_error("Not logged in") if user.isdirector != 1: db.close() return evec_func.simple_error("Not director - only directors can do that") r = Corp.create(db, user.corpid, user.corporation) if r is False: db.close() return evec_func.simple_error("Corp exists") emit_redirect('/corps/') db.close()
def typesearch(self, search=""): session = EVCstate() t = display.template('typesearch.tmpl', session) t.search = search db = evec_func.db_con() search = search.lower() search = "%" + search + "%" notmask = '%Blueprint' if search.find('blueprint') != -1: notmask = 'this wont ever exist' cur = db.cursor() cur.execute( "SELECT typename,typeid FROM types WHERE typename ILIKE %s AND typename NOT ILIKE %s ORDER BY typename", [search, notmask]) types = [] item = cur.fetchone() while item: types.append({'typeid': item[1], 'typename': item[0]}) item = cur.fetchone() t.types = types db.close() if len(types) == 1: emit_redirect('/home/quicklook.html?typeid=' + str(int(types[0]['typeid']))) return return t.respond()