Browse Source

Mon Nov 5 12:49:46 IST 2018

master
abhishekbalam 1 year ago
parent
commit
28e098c9ab
7 changed files with 8 additions and 69 deletions
  1. 0
    6
      .directory
  2. 3
    1
      .gitignore
  3. 1
    1
      Procfile
  4. 1
    20
      app.py
  5. 0
    41
      db.py
  6. 0
    0
      newsletter.json
  7. 3
    0
      static/css/main.css

+ 0
- 6
.directory View File

@@ -1,6 +0,0 @@
[Dolphin]
Timestamp=2018,10,2,15,46,20
Version=4

[Settings]
HiddenFilesShown=true

+ 3
- 1
.gitignore View File

@@ -1 +1,3 @@
cayman/
venv
*.pyc
__pycache__

+ 1
- 1
Procfile View File

@@ -1 +1 @@
web: gunicorn app:app --log-file -
web: gunicorn app:app --log-file -

+ 1
- 20
app.py View File

@@ -2,7 +2,6 @@ import os
from flask import Flask, render_template, request, redirect, jsonify, abort
import requests
from flask_mail import Mail, Message
import db

app = Flask(__name__)

@@ -13,14 +12,6 @@ app.config['MAIL_PASSWORD'] = os.environ['zoho_password2']
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True

data1={
"links":{
"title":"Title",
"description":"Subtitle",
"url":"https://mail.keeplink.in/"
}
}

@app.route('/')
def main():
return render_template('index.html')
@@ -28,8 +19,6 @@ def main():
@app.route('/sent/<email>')
def sent(email):
return render_template('sent.html', email=email)
# links="ljdlkajsldkja<br>lskdjlaksjdlkasd<br>dakshdksd<br>asldjkas"
# return render_template('email.html', subject="fsdfs", links=links)

def verify(email):
token="7996de2b-d743-4536-a107-5252fec5c828"
@@ -41,31 +30,23 @@ def verify(email):
@app.route('/send', methods = ['POST'])
def send():
data=request.form
email=data['email'].strip()
subject=data['subject'].strip()
link=data['links'].strip()
# print(links)
# links=links.replace('\n', '<br>')
arr=link.split('\n')
links="<ol>\n"
for i in range(len(arr)):
links=links + "<li><a href='"+arr[i]+"' target='_blank'>"+arr[i]+"</a></li>"
links=links+"\n<ol>"
if(verify(email)==False):
text="Invalid Email"
return render_template('error.html', text=text, again=True)

mail = Mail(app)
msg = Message(subject, sender = ('Keeplink.in', '[email protected]'), recipients = [email])
msg.html = render_template('email.html', subject=subject, links=links)
test=mail.send(msg)
print(test)
# print(test)
return redirect("/sent/"+email, code=302)

if __name__ == '__main__':

+ 0
- 41
db.py View File

@@ -1,41 +0,0 @@
import os
import redis

# For Remote DB
# db=redis.from_url(os.environ['REDISCLOUD_URL'])

# For Local DB
db=redis.Redis(host='localhost', port=6379, password='')

def adduser(firstname,lastname,email):
name=firstname+','+lastname+',0'
if(db.hsetnx("users",email,name)):
return True
else:
return False

def getusers():
return db.hgetall("users");

def validateuser(email):
user=db.hget("users", email);
if(user is None ):
return False
else:
user=user.replace('0','1')
db.hset("users", email, user)
return True

def deluser(email):
status=db.hdel("users",email)
print(email)
print(status)
if(status):
return True
else:
return False


# adduser("Abhishek","Balam","[email protected]")
# adduser("Rambo","Balam","[email protected]")
# adduser("Arnold","Balam","[email protected]")

+ 0
- 0
newsletter.json View File


+ 3
- 0
static/css/main.css View File

@@ -14,6 +14,9 @@ body {
transform: scale(0.95);
transform-origin: 0 0;
}
.card-body{
margin-top: 70px;
}
}

.logo a{

Loading…
Cancel
Save