whoops, adding 'create' back in

This commit is contained in:
Andrew Davidson 2012-03-12 19:23:58 -07:00
parent ade6c0bd66
commit 34fc3a1193

View file

@ -72,27 +72,7 @@ def get_generated_from_url(domain):
class index:
def GET(self, method):
if method == 'get':
if web.input():
i = web.input()
selected = get_pair_from_url(i.base_url)
if len(selected) > 0:
pairs = '<ul>'
for p in selected:
pairs += '<li>'+p.username+', '+p.password+'</li>'
pairs += '</ul>'
else:
pairs = "<p>Sorry buddy, you're outta luck</p>"
body = '<h1>'+i.base_url+'</h1>\n'+pairs
return render.page(i.base_url, body)
else:
return render.page('get','<p>need input.</p>')
if method == 'new':
i = web.input()
@ -122,6 +102,26 @@ class index:
return render.page('create',''.join(body))
if method == 'create':
i = web.input()
exists = db.select('passwords', where='username="'+i.username+'" and password="' +\
i.password+'" and base_url="'+i.base_url+'"')
if not exists:
n = db.insert('passwords', username=i.username, password=i.password, \
base_url=i.base_url)
selected = get_pair_from_url(i.base_url)
body = ['<h1>'+i.base_url+'</h1>','']
for pair in selected:
body.append('('+pair.username+', '+pair.password+')')
return render.page('Created', ''.join(body))
if method == 'js-overlay':
return '''\
(function() {