Commit bc399c5f by vuj

2018-01-17 v0.1.10 Mail Info

2 parents df3746f7 315d06fc
2018-01-17 v0.1.8 Mail Info
2018-01-17 v0.1.10 Mail Info
2018-01-19 v0.1.9 Cookie 1 Tag
2018-01-19 v0.1.8 small fixes
2018-01-17 v0.1.7 Posttools Monitoring
2018-01-16 v0.1.6 Posttools Fix
2018-01-16 v0.1.5 Posttools
......
......@@ -112,13 +112,13 @@ class mailcnf_domain(ncauth_base):
def update_virtual_domains(self, id,name,active,group_id):
query = "UPDATE virtual_domains SET name='"+str(name)+"' ,active='"+str(active)+"' ,group_id='"+str(group_id)+"' WHERE id="+str(id)+" "
try:
self.write(query)
# self.write(query)
db_config = read_db_config()
conn = MySQLConnection(**db_config)
cursor = conn.cursor()
cursor.execute(query)
conn.commit()
self.write(query)
# self.write(query)
except Error as error:
print(error)
finally:
......@@ -129,7 +129,7 @@ class mailcnf_domain(ncauth_base):
def insert_virtual_domain(self,name,active,group_id=0):
query = "INSERT INTO virtual_domains(name,active,group_id) VALUE('"+name+"','"+str(active)+"','"+str(group_id)+"');"
self.write(query)
# self.write(query)
# args = (domain_id,password,email,sent_mail,active)
insert_id = ''
try:
......@@ -167,7 +167,7 @@ class mailcnf_domain(ncauth_base):
else:
query = " SELECT id,name,description,transport,modified,active,deleted,group_id FROM `virtual_domains`"
try:
print(query)
#print(query)
db_config = read_db_config()
conn = MySQLConnection(**db_config)
cursor = conn.cursor()
......@@ -193,7 +193,7 @@ class mailcnf_domain(ncauth_base):
def edit_virtual_domains_by_id(self, id,uid):
query = " SELECT * FROM `virtual_domains` WHERE `id`='"+str(id)+"'"
query = " SELECT id,name,description,transport,modified,active,deleted,group_id FROM `virtual_domains` WHERE `id`='"+str(id)+"'"
dictdata =[]
# self.write(query)
counter=0
......
......@@ -184,7 +184,7 @@ class mailcnf_user(ncauth_base):
password=crypt.crypt(pw1,'$1$1x87mPvWg')
query = "INSERT INTO virtual_users(domain_id,password,email,sent_mail,active,quota,group_id) VALUES('"+domain_id+"','"+password+"','"+email+"','"+sent_mail+"','"+active+"','"+quota+"','"+group_id+"')"
self.write(query)
#self.write(query)
# args = (domain_id,password,email,sent_mail,active)
insert_id = ''
try:
......
import tornado
import tornado.web
from tornado.web import RequestHandler
#import tornado.web
#import tornado.websocket.WebSocketHandler
#import tornado.web.RequestHandler
class ncauth_base(tornado.web.RequestHandler):
def get_current_user(self):
return self.get_secure_cookie("user")
#test=RequestHandler.get_secure_cookie_key_version("user");
#self.write(test)
for cookie_key in self.request.cookies.keys():
cookie = self.request.cookies[cookie_key]
print(cookie_key, cookie['expires'], cookie.output())
return self.get_secure_cookie("user",min_version=2,max_age_days=1)
......@@ -14,19 +14,21 @@ class ncauth_user(ncauth_base):
# '</form></body></html>')
def post(self):
self.set_secure_cookie("user", self.get_argument("name"))
self.set_secure_cookie("user", self.get_argument("name"),expires_days=1,secure=True)
# self.set_secure_cookie("expires_days", "1")
pw=self.get_argument("password")
username=self.get_argument("name")
salt='xy4$rt'
#hashlib.sha512(pw.encode('utf-8') + salt.encode('utf-8')).hexdigest()
if hashlib.md5(pw.encode('utf-8')).hexdigest() == self.getuserpw(username):
self.set_secure_cookie("user", self.get_argument("name"))
self.set_secure_cookie("incorrect", "0")
self.write("Jo")
self.set_secure_cookie("user", self.get_argument("name"),expires_days=1,secure=True)
self.set_secure_cookie("incorrect", "0",expires_days=1,secure=True)
# self.write("Jo")
self.redirect("/")
else:
self.write("Hello, world"+self.get_argument("name")+' '+self.get_argument("password")+ ' /// '+hashlib.md5(pw.encode('utf-8')).hexdigest() +' vs. '+self.getuserpw(username))
self.set_secure_cookie("incorrect", "1")
# self.write("Hello, world"+self.get_argument("name")+' '+self.get_argument("password")+ ' /// '+hashlib.md5(pw.encode('utf-8')).hexdigest() +' vs. '+self.getuserpw(username))
self.set_secure_cookie("incorrect", "1",expires_days=1,secure=True)
self.redirect("/login")
......
......@@ -64,7 +64,7 @@ def make_app():
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
debug=True,
cookie_secret='ancsrvcnf2'
cookie_secret='axcermnogtlehdded12334'
)
......
......@@ -39,7 +39,7 @@
<tr>
<td>Aktiv: </td>
<td><input type="checkbox" size="40" name="active" {% if list[5] == 1 %} value="1" checked {% else %} value="0" {% end %}></td>
<td><input type="checkbox" size="40" name="active" {% if list[5] == 1 %} value="1" checked {% else %} value="1" {% end %}></td>
</tr>
<input type="hidden" size="70" name="fnc" value="submitedit">
......
......@@ -38,7 +38,7 @@
</tr>
<tr>
<td>Aktiv: </td>
<td><input type="checkbox" size="40" name="active" {% if list[5] == 1 %} value="1" checked {% else %} value="0" {% end %}></td>
<td><input type="checkbox" size="40" name="active" {% if list[5] == 1 %} value="1" checked {% else %} value="1" {% end %}></td>
</tr>
<input type="hidden" size="70" name="fnc" value="submitedit">
......
......@@ -27,7 +27,7 @@
<tr>
<td>Aktiv: </td>
<td><input type="checkbox" size="40" name="active" {% if list[5] == 1 %} value="1" checked {% else %} value="0" {% end %}></td>
<td><input type="checkbox" size="40" name="active" {% if list[5] == 1 %} value="1" checked {% else %} value="1" {% end %}></td>
</tr>
<input type="hidden" size="70" name="fnc" value="submitedit">
......
......@@ -45,11 +45,11 @@
<tr>
<td>Sent Mail:</td>
<td><input type="checkbox" size="40" name="sent_mail" {% if list[6] == 1 %} value="1" checked {% else %} value="0" {% end %} ></td>
<td><input type="checkbox" size="40" name="sent_mail" {% if list[6] == 1 %} value="1" checked {% else %} value="1" {% end %} ></td>
</tr>
<tr>
<td>Aktiv: </td>
<td><input type="checkbox" size="40" name="active" {% if list[9] == 1 %} value="1" checked {% else %} value="0" {% end %}></td>
<td><input type="checkbox" size="40" name="active" {% if list[9] == 1 %} value="1" checked {% else %} value="1" {% end %}></td>
</tr>
<input type="hidden" size="70" name="fnc" value="submitedit">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!