Added register reason

This commit is contained in:
spla 2021-07-26 15:43:02 +02:00
pare 7a3f26a263
commit 0b37d944bb
S'han modificat 2 arxius amb 9 adicions i 5 eliminacions

Veure arxiu

@ -150,7 +150,7 @@ if __name__ == '__main__':
db_user = spamcheck_db_user db_user = spamcheck_db_user
table = "spamcheck" table = "spamcheck"
sql = "create table "+table+" (created_at timestamptz, id bigint PRIMARY KEY, email varchar(200), ip inet)" sql = "create table "+table+" (created_at timestamptz, id bigint PRIMARY KEY, email varchar(200), ip inet, text varchar(200))"
create_table(db, db_user, table, sql) create_table(db, db_user, table, sql)
############################################################ ############################################################

Veure arxiu

@ -55,6 +55,8 @@ if __name__ == '__main__':
email_lst = [] email_lst = []
ip_lst = [] ip_lst = []
text_lst = []
try: try:
@ -64,7 +66,7 @@ if __name__ == '__main__':
cur = conn.cursor() cur = conn.cursor()
cur.execute("select created_at, id, email, sign_up_ip from users where not approved;") cur.execute("select users.created_at, users.id, users.email, users.sign_up_ip, user_invite_requests.text from users, user_invite_requests where not users.approved and users.id = user_invite_requests.user_id")
rows = cur.fetchall() rows = cur.fetchall()
@ -80,6 +82,8 @@ if __name__ == '__main__':
ip_lst.append(row[3]) ip_lst.append(row[3])
text_lst.append(row[4])
cur.close() cur.close()
except (Exception, psycopg2.DatabaseError) as error: except (Exception, psycopg2.DatabaseError) as error:
@ -94,7 +98,7 @@ if __name__ == '__main__':
############################################################################### ###############################################################################
insert_sql = 'INSERT INTO spamcheck(created_at, id, email, ip) VALUES(%s,%s,%s,%s) ON CONFLICT DO NOTHING' insert_sql = 'INSERT INTO spamcheck(created_at, id, email, ip, text) VALUES(%s,%s,%s,%s,%s) ON CONFLICT DO NOTHING'
i = 0 i = 0
@ -108,7 +112,7 @@ if __name__ == '__main__':
cur = conn.cursor() cur = conn.cursor()
cur.execute(insert_sql, (created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i])) cur.execute(insert_sql, (created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i], text_lst[i]))
conn.commit() conn.commit()
@ -124,7 +128,7 @@ if __name__ == '__main__':
conn.close() conn.close()
print(created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i]) print(created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i], text_lst[i])
i = i + 1 i = i + 1