Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect from contacts to compose mail with username #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified database/clouduse.sqlt
Binary file not shown.
Binary file modified database/localuse.sqlt
Binary file not shown.
19 changes: 16 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@ def dashbord():
else:
return redirect(url_for("invalses"))


@main.route("/makemail/<receiver>", methods=["GET", "POST"])
@main.route("/makemail/", methods=["GET", "POST"])
def makemail(erorcode=""):
def makemail(erorcode="",receiver=""):
#print ("URL",request.remote_addr)
#print (" "*25,"receiver : ",receiver," "*25)

if 'username' in session:
username = session['username']
if receiver !="" :
srchuser = libr_makemail.acntexst(receiver)
#print(srchuser)
if srchuser == False or receiver == username:
receiver=""
return redirect(url_for("makemail"))

if request.method == "POST":
receiver = request.form["receiver"]
subjtext = request.form["subjtext"]
Expand All @@ -44,7 +56,8 @@ def makemail(erorcode=""):
else:
erorcode = "mailsucc"
libr_makemail.sendmail(subjtext, conttext, username, receiver)
return render_template("makemoil.html", username=username, versinfo=versinfo, erorlist=erorlist, erorcode=erorcode)
return redirect(url_for('makemail'))
return render_template("makemoil.html", username=username,receiver=receiver ,versinfo=versinfo, erorlist=erorlist, erorcode=erorcode)
else:
return redirect(url_for("invalses"))

Expand Down Expand Up @@ -314,4 +327,4 @@ def makeacnt(erorcode = ""):
return render_template("makeocnt.html", versinfo=versinfo, erorlist=erorlist, erorcode=erorcode)

if __name__ == "__main__":
main.run(port=9696, host="0.0.0.0")
main.run()
4 changes: 3 additions & 1 deletion templates/contocts.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ <h3 class="card-title">Saved contacts</h3>
{{ indx.username }}
</a>
<br/>
<small>{{ indx.fullname }}</small>
<a href="{{ url_for('makemail',receiver=indx.username) }}" >
<small>{{ indx.fullname }}</small>
</a>
</div>
<br/>
{% endfor %}
Expand Down
6 changes: 5 additions & 1 deletion templates/makemoil.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ <h3 class="card-title">Compose new message</h3>
<form id="makemail" method="POST">
<div class="card-body">
<div class="form-group">
<input class="form-control" name="receiver" placeholder="Add the username of the receiver" />
{% if receiver!="" %}
<input class="form-control" name="receiver" value='{{ receiver }}' placeholder="Add the username of the receiver" readonly/>
{% else %}
<input class="form-control" name="receiver" placeholder="Add the username of the receiver" />
{% endif %}
</div>
<div class="form-group">
<input class="form-control" name="subjtext" placeholder="Add the subject of your directive" />
Expand Down