forked from github/server
vin: removed notice about disabling, re-enabled page. english text for eressea
This commit is contained in:
parent
69b6570700
commit
57bd961a99
|
@ -1,5 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# If (password, custid) exist in the database, and the user is in state
|
||||||
|
# 'WAITING', he will be changed to 'CONFIRMED'.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import MySQLdb
|
import MySQLdb
|
||||||
import cgi
|
import cgi
|
||||||
|
@ -64,7 +67,7 @@ if (password==None) or (custid==None):
|
||||||
else:
|
else:
|
||||||
db=MySQLdb.connect(db=dbname)
|
db=MySQLdb.connect(db=dbname)
|
||||||
cursor=db.cursor()
|
cursor=db.cursor()
|
||||||
exist=cursor.execute("select id from users where id="+custid+" and password='"+password+"'")
|
exist=cursor.execute("select id from users where id="+custid+" and status='WAITING' and password='"+password+"'")
|
||||||
if exist==0:
|
if exist==0:
|
||||||
Display('<p>Kundennummer oder Schlüssel falsch. Bitte beachte, dass Du beim Schlüssel auf Groß- und Kleinschreibung achten mußt.')
|
Display('<p>Kundennummer oder Schlüssel falsch. Bitte beachte, dass Du beim Schlüssel auf Groß- und Kleinschreibung achten mußt.')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -52,8 +52,8 @@ def Send(email, custid, firstname, password, position):
|
||||||
SubResult = re.subn("<PASSWORD>", password, SubResult[0])
|
SubResult = re.subn("<PASSWORD>", password, SubResult[0])
|
||||||
SubResult = re.subn("<POSITION>", str(int(position)), SubResult[0])
|
SubResult = re.subn("<POSITION>", str(int(position)), SubResult[0])
|
||||||
SubResult = re.subn("<CUSTID>", str(int(custid)), SubResult[0])
|
SubResult = re.subn("<CUSTID>", str(int(custid)), SubResult[0])
|
||||||
|
subject={"de":"Eressea Anmeldung","en":"Eressea Registration"}
|
||||||
Msg="From: "+From+"\nTo: "+email+"\nSubject: Eressea Anmeldung\n\n"
|
Msg="From: "+From+"\nTo: "+email+"\nSubject: "+subject[locale]+"\n\n"
|
||||||
Msg=Msg+SubResult[0]
|
Msg=Msg+SubResult[0]
|
||||||
server=smtplib.SMTP(smtpserver)
|
server=smtplib.SMTP(smtpserver)
|
||||||
server.sendmail(From, email, Msg)
|
server.sendmail(From, email, Msg)
|
||||||
|
@ -110,10 +110,19 @@ elif ValidEmail(email)==0:
|
||||||
else:
|
else:
|
||||||
db=MySQLdb.connect(db=dbname)
|
db=MySQLdb.connect(db=dbname)
|
||||||
cursor=db.cursor()
|
cursor=db.cursor()
|
||||||
exist=cursor.execute("select id from users where email='"+email+"' and (status='WAITING' or status='PENDING')")
|
exist=cursor.execute("select id from users where email='"+email+"' and (status='WAITING' or status='CONFIRMED')")
|
||||||
if exist>0:
|
if exist:
|
||||||
Display('<p>Du stehst bereits auf der Warteliste')
|
text={"de":"Du stehst bereits auf der Warteliste","en":"You are already on the waiting list"}
|
||||||
|
Display('<p>'+text[locale])
|
||||||
else:
|
else:
|
||||||
|
bans=cursor.execute('select regex, reason from bannedemails')
|
||||||
|
while bans:
|
||||||
|
bans=bans-1
|
||||||
|
regexp, reason = cursor.fetchone()
|
||||||
|
if (re.match(regexp, email, re.IGNORECASE))!=None:
|
||||||
|
Display('Deine Email-Adresse ist für Eressea nicht zugelassen. '+reason)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
password=genpasswd()
|
password=genpasswd()
|
||||||
fields = "firstname, lastname, locale, email, address, city, status, password"
|
fields = "firstname, lastname, locale, email, address, city, status, password"
|
||||||
values = "'"+firstname+"', '"+lastname+"', '"+locale+"', '"+email+"', '"+address+"', '"+city+"', 'WAITING', '"+password+"'"
|
values = "'"+firstname+"', '"+lastname+"', '"+locale+"', '"+email+"', '"+address+"', '"+city+"', 'WAITING', '"+password+"'"
|
||||||
|
@ -138,11 +147,14 @@ else:
|
||||||
cursor.execute("insert into users ("+fields+") VALUES ("+values+")")
|
cursor.execute("insert into users ("+fields+") VALUES ("+values+")")
|
||||||
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
||||||
custid=cursor.fetchone()[0]
|
custid=cursor.fetchone()[0]
|
||||||
|
ip=None
|
||||||
if os.environ.has_key('REMOTE_ADDR'):
|
if os.environ.has_key('REMOTE_ADDR'):
|
||||||
ip=os.environ['REMOTE_ADDR']
|
ip=os.environ['REMOTE_ADDR']
|
||||||
|
if ip!=None:
|
||||||
cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
|
cursor.execute("REPLACE userips (ip, user) VALUES ('"+ip+"', "+str(int(custid))+")")
|
||||||
cursor.execute("insert into subscriptions (user, race, game, status) VALUES ("+str(int(custid))+", '"+race+"', 0, 'PENDING')")
|
cursor.execute("insert into subscriptions (user, race, game, status) VALUES ("+str(int(custid))+", '"+race+"', 0, 'PENDING')")
|
||||||
cursor.execute("select count(*) from users where status='WAITING' or status='CONFIRMED'")
|
cursor.execute("select count(*) from users where status='WAITING' or status='CONFIRMED'")
|
||||||
Send(email, custid, firstname, password, cursor.fetchone()[0])
|
Send(email, custid, firstname, password, cursor.fetchone()[0])
|
||||||
Display("<p>Deine Anmeldung wurde bearbeitet. Eine EMail mit Hinweisen ist unterwegs zu Dir.")
|
text={"de":"Deine Anmeldung wurde bearbeitet. Eine EMail mit Hinweisen ist unterwegs zu Dir", "en":"Your application was processed. An email containing further instructions is being sent to you"}
|
||||||
|
Display("<p>"+text[locale]+".")
|
||||||
db.close()
|
db.close()
|
||||||
|
|
|
@ -62,7 +62,11 @@ def ShowPage():
|
||||||
|
|
||||||
output=output+'</table>'
|
output=output+'</table>'
|
||||||
output=output+'<p><table><tr><td>Kundennummer:</td><td><input name="user" size="4"></tr><tr><td>Passwort:</td><td><input name="pass" type="password" size="40"></td>'
|
output=output+'<p><table><tr><td>Kundennummer:</td><td><input name="user" size="4"></tr><tr><td>Passwort:</td><td><input name="pass" type="password" size="40"></td>'
|
||||||
output=output+'<tr><td><input name="save" type="submit" value="Abschicken"></td></tr></table>'
|
output=output+'<tr><td>'
|
||||||
|
output=output+'<input name="save" type="submit" value="Abschicken">'
|
||||||
|
output=output+'</td></tr></table>'
|
||||||
|
# output=output+'<p>Aus technischen Gründen wird diese Seite erst am Dienstag abend wieder benutzbar sein.'
|
||||||
|
|
||||||
output=output+'</form></div>'
|
output=output+'</form></div>'
|
||||||
Display(output)
|
Display(output)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue