mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Add email field
This commit is contained in:
parent
f0cca142c4
commit
dc76a28718
3 changed files with 8 additions and 14 deletions
|
@ -71,7 +71,7 @@ code {
|
||||||
font-family: "Consolas", "Source Code Pro", monospace;
|
font-family: "Consolas", "Source Code Pro", monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"], input[type="password"] {
|
input[type="text"], input[type="password"], input[type="email"] {
|
||||||
background-color: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.1);
|
background-color: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.1);
|
||||||
color: @text-color;
|
color: @text-color;
|
||||||
border: none;
|
border: none;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
Modifica profilo
|
Modifica profilo
|
||||||
</h1>
|
</h1>
|
||||||
<form action="{{ url_for('page_editprofile') }}" method="POST">
|
<form action="{{ url_for('page_editprofile') }}" method="POST">
|
||||||
|
<input type="email" name="email" placeholder="La tua e-mail (Gravatar)" value="{{ royal.email }}"><br>
|
||||||
Puoi usare il <a href="{{ url_for('page_wiki', key='Meta') }}">Markdown</a> nella tua bio.
|
Puoi usare il <a href="{{ url_for('page_wiki', key='Meta') }}">Markdown</a> nella tua bio.
|
||||||
<textarea name="bio" placeholder="Scrivi la tua bio qui... (Markdown supportato)">{{ data.bio }}</textarea>
|
<textarea name="bio" placeholder="Scrivi la tua bio qui... (Markdown supportato)">{{ data.bio }}</textarea>
|
||||||
Se vuoi, puoi personalizzare il tuo profilo con un tuo <a href="https://www.w3schools.com/css/css_howto.asp">foglio di stile!</a>
|
Se vuoi, puoi personalizzare il tuo profilo con un tuo <a href="https://www.w3schools.com/css/css_howto.asp">foglio di stile!</a>
|
||||||
|
|
19
webserver.py
19
webserver.py
|
@ -194,33 +194,26 @@ def page_password():
|
||||||
@app.route("/editprofile", methods=["GET", "POST"])
|
@app.route("/editprofile", methods=["GET", "POST"])
|
||||||
@require_login
|
@require_login
|
||||||
def page_editprofile():
|
def page_editprofile():
|
||||||
profile_data = fl_g.session.query(db.ProfileData).filter_by(royal_id=fl_g.user.id).join(db.Royal).one_or_none()
|
royal = fl_g.session.query(db.Royal).filter_by(id=fl_g.user.id).one()
|
||||||
|
profile_data = fl_g.session.query(db.ProfileData).filter_by(royal=royal).one_or_none()
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
return render_template("profileedit.html", data=profile_data)
|
return render_template("profileedit.html", royal=royal, data=profile_data)
|
||||||
elif request.method == "POST":
|
elif request.method == "POST":
|
||||||
css = request.form.get("css", "")
|
css = request.form.get("css", "")
|
||||||
bio = request.form.get("bio", "")
|
bio = request.form.get("bio", "")
|
||||||
|
email = request.form.get("email")
|
||||||
if "</style" in css:
|
if "</style" in css:
|
||||||
abort(400)
|
abort(400)
|
||||||
return
|
return
|
||||||
|
royal.email = email
|
||||||
if profile_data is None:
|
if profile_data is None:
|
||||||
profile_data = db.ProfileData(royal_id=fl_g.user.id, css=css, bio=bio)
|
profile_data = db.ProfileData(royal=royal, css=css, bio=bio)
|
||||||
fl_g.session.add(profile_data)
|
fl_g.session.add(profile_data)
|
||||||
fl_g.session.flush()
|
fl_g.session.flush()
|
||||||
profile_data.royal.fiorygi += 1
|
|
||||||
try:
|
|
||||||
telegram_bot.send_message(config["Telegram"]["main_group"],
|
|
||||||
f'⭐️ {profile_data.royal.username} ha'
|
|
||||||
f' <a href="http://ryg.steffo.eu/editprofile">configurato la sua bio</a>'
|
|
||||||
f' su Royalnet e ha ottenuto un fioryg!',
|
|
||||||
parse_mode="HTML", disable_web_page_preview=True, disable_notification=True)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
profile_data.css = css
|
profile_data.css = css
|
||||||
profile_data.bio = bio
|
profile_data.bio = bio
|
||||||
fl_g.session.commit()
|
fl_g.session.commit()
|
||||||
royal = fl_g.session.query(db.Royal).filter_by(id=fl_g.user.id).one()
|
|
||||||
return redirect(url_for("page_profile", name=royal.username))
|
return redirect(url_for("page_profile", name=royal.username))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue