1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-24 18:47:23 +00:00

User edit email fix

This commit is contained in:
Jan Broer 2015-08-02 21:43:33 +02:00
parent aef608aa10
commit 0b5b3b8424
3 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,7 @@
<form role="form" method="POST"> <form role="form" method="POST">
<div class="form-group"> <div class="form-group">
<label for="email">e-mail</label> <label for="email">e-mail</label>
<input type="email" class="form-control" name="email" id="email" value="{{content.email}}"> <input type="email" class="form-control" name="email" id="email" value="{{ content.email if content.email != None }}">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password">password</label> <label for="password">password</label>
@ -13,16 +13,16 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="kindle_mail">Kindle E-Mail</label> <label for="kindle_mail">Kindle E-Mail</label>
<input type="text" class="form-control" name="kindle_mail" id="kindle_mail" value="{{content.kindle_mail}}"> <input type="text" class="form-control" name="kindle_mail" id="kindle_mail" value="{{ content.kindle_mail if content.kindle_mail != None }}">
</div> </div>
{% if g.user and g.user.role %} {% if g.user and g.user.role %}
<div class="form-group"> <div class="form-group">
<label for="user_role">is admin</label> <label for="user_role">Admin user? 0 or 1</label>
<input type="text" class="form-control" name="user_role" id="user_role" value="{{content.role}}"> <input type="text" class="form-control" name="user_role" id="user_role" value="{{ content.role if content.role != None }}">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="nickname">nickname</label> <label for="nickname">nickname</label>
<input type="text" class="form-control" name="nickname" id="nickname" value="{{content.nickname}}"> <input type="text" class="form-control" name="nickname" id="nickname" value="{{ content.nickname if content.nickname != None }}">
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label> <label>

View File

@ -21,7 +21,7 @@ class User(Base):
id = Column(Integer, primary_key = True) id = Column(Integer, primary_key = True)
nickname = Column(String(64), unique = True) nickname = Column(String(64), unique = True)
email = Column(String(120), unique = True) email = Column(String(120), unique = True, default = "")
role = Column(SmallInteger, default = ROLE_USER) role = Column(SmallInteger, default = ROLE_USER)
password = Column(String) password = Column(String)
kindle_mail = Column(String(120), default="") kindle_mail = Column(String(120), default="")

View File

@ -324,16 +324,16 @@ def logout():
def send_to_kindle(book_id): def send_to_kindle(book_id):
settings = ub.get_mail_settings() settings = ub.get_mail_settings()
if settings.get("mail_server", "mail.example.com") == "mail.example.com": if settings.get("mail_server", "mail.example.com") == "mail.example.com":
flash("please configure your email account settings first...", category="error") flash("Please configure the SMTP email account first...", category="error")
elif current_user.kindle_mail: elif current_user.kindle_mail:
x = helper.send_mail(book_id, current_user.kindle_mail) x = helper.send_mail(book_id, current_user.kindle_mail)
if x: if x:
flash("mail successfully send to %s" % current_user.kindle_mail, category="success") flash("Mail successfully send to %s" % current_user.kindle_mail, category="success")
helper.update_download(book_id, int(current_user.id)) helper.update_download(book_id, int(current_user.id))
else: else:
flash("there was an error sending this book", category="error") flash("There was an error sending this book", category="error")
else: else:
flash("please set a kindle mail first...", category="error") flash("Please set a kindle mail first...", category="error")
return redirect(request.environ["HTTP_REFERER"]) return redirect(request.environ["HTTP_REFERER"])
@app.route("/shelf/add/<int:shelf_id>/<int:book_id>") @app.route("/shelf/add/<int:shelf_id>/<int:book_id>")