English Language Updates - V3

This commit is contained in:
Josh O'Brien 2023-01-04 13:30:13 +11:00
parent ce0b3d8d10
commit b3335f6733
13 changed files with 127 additions and 127 deletions

View File

@ -145,9 +145,9 @@ def shutdown():
ub.dispose() ub.dispose()
if task == 0: if task == 0:
show_text['text'] = _(u'Server restarted, please reload page') show_text['text'] = _(u'Server restarted, please reload page.')
else: else:
show_text['text'] = _(u'Performing shutdown of server, please close window') show_text['text'] = _(u'Performing Server shutdown, please close window.')
# stop gevent/tornado server # stop gevent/tornado server
web_server.stop(task == 0) web_server.stop(task == 0)
return json.dumps(show_text) return json.dumps(show_text)
@ -155,7 +155,7 @@ def shutdown():
if task == 2: if task == 2:
log.warning("reconnecting to calibre database") log.warning("reconnecting to calibre database")
calibre_db.reconnect_db(config, ub.app_DB_path) calibre_db.reconnect_db(config, ub.app_DB_path)
show_text['text'] = _(u'Reconnect successful') show_text['text'] = _(u'Success! Database Reconnected')
return json.dumps(show_text) return json.dumps(show_text)
show_text['text'] = _(u'Unknown command') show_text['text'] = _(u'Unknown command')
@ -169,7 +169,7 @@ def queue_metadata_backup():
show_text = {} show_text = {}
log.warning("Queuing all books for metadata backup") log.warning("Queuing all books for metadata backup")
helper.set_all_metadata_dirty() helper.set_all_metadata_dirty()
show_text['text'] = _(u'Books successfully queued for Metadata Backup') show_text['text'] = _(u'Success! Books queued for Metadata Backup')
return json.dumps(show_text) return json.dumps(show_text)
@ -1256,7 +1256,7 @@ def new_user():
content.default_language = config.config_default_language content.default_language = config.config_default_language
return render_title_template("user_edit.html", new_user=1, content=content, return render_title_template("user_edit.html", new_user=1, content=content,
config=config, translations=translations, config=config, translations=translations,
languages=languages, title=_(u"Add new user"), page="newuser", languages=languages, title=_(u"Add New User"), page="newuser",
kobo_support=kobo_support, registered_oauth=oauth_check) kobo_support=kobo_support, registered_oauth=oauth_check)
@ -1265,7 +1265,7 @@ def new_user():
@admin_required @admin_required
def edit_mailsettings(): def edit_mailsettings():
content = config.get_mail_settings() content = config.get_mail_settings()
return render_title_template("email_edit.html", content=content, title=_(u"Edit E-mail Server Settings"), return render_title_template("email_edit.html", content=content, title=_(u"Edit Email Server Settings"),
page="mailset", feature_support=feature_support) page="mailset", feature_support=feature_support)
@ -1284,7 +1284,7 @@ def update_mailsettings():
elif to_save.get("gmail"): elif to_save.get("gmail"):
try: try:
config.mail_gmail_token = services.gmail.setup_gmail(config.mail_gmail_token) config.mail_gmail_token = services.gmail.setup_gmail(config.mail_gmail_token)
flash(_(u"Gmail Account Verification Successful"), category="success") flash(_(u"Success! Gmail Account Verified."), category="success")
except Exception as ex: except Exception as ex:
flash(str(ex), category="error") flash(str(ex), category="error")
log.error(ex) log.error(ex)
@ -1425,13 +1425,13 @@ def reset_user_password(user_id):
ret, message = reset_password(user_id) ret, message = reset_password(user_id)
if ret == 1: if ret == 1:
log.debug(u"Password for user %s reset", message) log.debug(u"Password for user %s reset", message)
flash(_(u"Password for user %(user)s reset", user=message), category="success") flash(_(u"Success! Password for user %(user)s reset", user=message), category="success")
elif ret == 0: elif ret == 0:
log.error(u"An unknown error occurred. Please try again later.") log.error(u"An unknown error occurred. Please try again later.")
flash(_(u"An unknown error occurred. Please try again later."), category="error") flash(_(u"Oops! An unknown error occurred. Please try again later."), category="error")
else: else:
log.error(u"Please configure the SMTP mail settings first...") log.error(u"Please configure the SMTP mail settings.")
flash(_(u"Please configure the SMTP mail settings first..."), category="error") flash(_(u"Oops! Please configure the SMTP mail settings."), category="error")
return redirect(url_for('admin.admin')) return redirect(url_for('admin.admin'))

60
cps/helper.py Executable file → Normal file
View File

@ -94,8 +94,8 @@ def convert_book_format(book_id, calibre_path, old_book_format, new_book_format,
# read settings and append converter task to queue # read settings and append converter task to queue
if ereader_mail: if ereader_mail:
settings = config.get_mail_settings() settings = config.get_mail_settings()
settings['subject'] = _('Send to E-Reader') # pretranslate Subject for e-mail settings['subject'] = _('Send to eReader') # pretranslate Subject for Email
settings['body'] = _(u'This e-mail has been sent via Calibre-Web.') settings['body'] = _(u'This Email has been sent via Calibre-Web.')
else: else:
settings = dict() settings = dict()
link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book.id), escape(book.title)) # prevent xss link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book.id), escape(book.title)) # prevent xss
@ -111,30 +111,30 @@ def convert_book_format(book_id, calibre_path, old_book_format, new_book_format,
# Texts are not lazy translated as they are supposed to get send out as is # Texts are not lazy translated as they are supposed to get send out as is
def send_test_mail(ereader_mail, user_name): def send_test_mail(ereader_mail, user_name):
WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web test e-mail'), None, None, WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web Test Email'), None, None,
config.get_mail_settings(), ereader_mail, N_(u"Test e-mail"), config.get_mail_settings(), ereader_mail, N_(u"Test Email"),
_(u'This e-mail has been sent via Calibre-Web.'))) _(u'This Email has been sent via Calibre-Web.')))
return return
# Send registration email or password reset email, depending on parameter resend (False means welcome email) # Send registration email or password reset email, depending on parameter resend (False means welcome email)
def send_registration_mail(e_mail, user_name, default_password, resend=False): def send_registration_mail(e_mail, user_name, default_password, resend=False):
txt = "Hello %s!\r\n" % user_name txt = "Hi %s!\r\n" % user_name
if not resend: if not resend:
txt += "Your new account at Calibre-Web has been created. Thanks for joining us!\r\n" txt += "Your account at Calibre-Web has been created.\r\n"
txt += "Please log in to your account using the following information:\r\n" txt += "Please log in using the following information:\r\n"
txt += "User name: %s\r\n" % user_name txt += "Username: %s\r\n" % user_name
txt += "Password: %s\r\n" % default_password txt += "Password: %s\r\n" % default_password
txt += "Don't forget to change your password after first login.\r\n" txt += "Don't forget to change your password after your first login.\r\n"
txt += "Sincerely\r\n\r\n" txt += "Regards,\r\n\r\n"
txt += "Your Calibre-Web team" txt += "Calibre-Web"
WorkerThread.add(None, TaskEmail( WorkerThread.add(None, TaskEmail(
subject=_(u'Get Started with Calibre-Web'), subject=_(u'Get Started with Calibre-Web'),
filepath=None, filepath=None,
attachment=None, attachment=None,
settings=config.get_mail_settings(), settings=config.get_mail_settings(),
recipient=e_mail, recipient=e_mail,
task_message=N_(u"Registration e-mail for user: %(name)s", name=user_name), task_message=N_(u"Registration Email for user: %(name)s", name=user_name),
text=txt text=txt
)) ))
return return
@ -145,13 +145,13 @@ def check_send_to_ereader_with_converter(formats):
if 'MOBI' in formats and 'EPUB' not in formats: if 'MOBI' in formats and 'EPUB' not in formats:
book_formats.append({'format': 'Epub', book_formats.append({'format': 'Epub',
'convert': 1, 'convert': 1,
'text': _('Convert %(orig)s to %(format)s and send to E-Reader', 'text': _('Convert %(orig)s to %(format)s and send to eReader',
orig='Mobi', orig='Mobi',
format='Epub')}) format='Epub')})
if 'AZW3' in formats and 'EPUB' not in formats: if 'AZW3' in formats and 'EPUB' not in formats:
book_formats.append({'format': 'Epub', book_formats.append({'format': 'Epub',
'convert': 2, 'convert': 2,
'text': _('Convert %(orig)s to %(format)s and send to E-Reader', 'text': _('Convert %(orig)s to %(format)s and send to eReader',
orig='Azw3', orig='Azw3',
format='Epub')}) format='Epub')})
return book_formats return book_formats
@ -159,7 +159,7 @@ def check_send_to_ereader_with_converter(formats):
def check_send_to_ereader(entry): def check_send_to_ereader(entry):
""" """
returns all available book formats for sending to E-Reader returns all available book formats for sending to eReader
""" """
formats = list() formats = list()
book_formats = list() book_formats = list()
@ -170,19 +170,19 @@ def check_send_to_ereader(entry):
if 'EPUB' in formats: if 'EPUB' in formats:
book_formats.append({'format': 'Epub', book_formats.append({'format': 'Epub',
'convert': 0, 'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Epub')}) 'text': _('Send %(format)s to eReader', format='Epub')})
if 'MOBI' in formats: if 'MOBI' in formats:
book_formats.append({'format': 'Mobi', book_formats.append({'format': 'Mobi',
'convert': 0, 'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Mobi')}) 'text': _('Send %(format)s to eReader', format='Mobi')})
if 'PDF' in formats: if 'PDF' in formats:
book_formats.append({'format': 'Pdf', book_formats.append({'format': 'Pdf',
'convert': 0, 'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Pdf')}) 'text': _('Send %(format)s to eReader', format='Pdf')})
if 'AZW' in formats: if 'AZW' in formats:
book_formats.append({'format': 'Azw', book_formats.append({'format': 'Azw',
'convert': 0, 'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Azw')}) 'text': _('Send %(format)s to eReader', format='Azw')})
if config.config_converterpath: if config.config_converterpath:
book_formats.extend(check_send_to_ereader_with_converter(formats)) book_formats.extend(check_send_to_ereader_with_converter(formats))
return book_formats return book_formats
@ -204,9 +204,9 @@ def check_read_formats(entry):
# Files are processed in the following order/priority: # Files are processed in the following order/priority:
# 1: If Mobi file is existing, it's directly send to E-Reader email, # 1: If Mobi file is existing, it's directly send to eReader email,
# 2: If Epub file is existing, it's converted and send to E-Reader email, # 2: If Epub file is existing, it's converted and send to eReader email,
# 3: If Pdf file is existing, it's directly send to E-Reader email # 3: If Pdf file is existing, it's directly send to eReader email
def send_mail(book_id, book_format, convert, ereader_mail, calibrepath, user_id): def send_mail(book_id, book_format, convert, ereader_mail, calibrepath, user_id):
"""Send email with attachments""" """Send email with attachments"""
book = calibre_db.get_book(book_id) book = calibre_db.get_book(book_id)
@ -222,10 +222,10 @@ def send_mail(book_id, book_format, convert, ereader_mail, calibrepath, user_id)
if entry.format.upper() == book_format.upper(): if entry.format.upper() == book_format.upper():
converted_file_name = entry.name + '.' + book_format.lower() converted_file_name = entry.name + '.' + book_format.lower()
link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book_id), escape(book.title)) link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book_id), escape(book.title))
email_text = N_(u"%(book)s send to E-Reader", book=link) email_text = N_(u"%(book)s send to eReader", book=link)
WorkerThread.add(user_id, TaskEmail(_(u"Send to E-Reader"), book.path, converted_file_name, WorkerThread.add(user_id, TaskEmail(_(u"Send to eReader"), book.path, converted_file_name,
config.get_mail_settings(), ereader_mail, config.get_mail_settings(), ereader_mail,
email_text, _(u'This e-mail has been sent via Calibre-Web.'))) email_text, _(u'This Email has been sent via Calibre-Web.')))
return return
return _(u"The requested file could not be read. Maybe wrong permissions?") return _(u"The requested file could not be read. Maybe wrong permissions?")
@ -640,8 +640,8 @@ def uniq(inpt):
def check_email(email): def check_email(email):
email = valid_email(email) email = valid_email(email)
if ub.session.query(ub.User).filter(func.lower(ub.User.email) == email.lower()).first(): if ub.session.query(ub.User).filter(func.lower(ub.User.email) == email.lower()).first():
log.error(u"Found an existing account for this e-mail address") log.error(u"Found an existing account for this Email address")
raise Exception(_(u"Found an existing account for this e-mail address")) raise Exception(_(u"Found an existing account for this Email address"))
return email return email
@ -660,8 +660,8 @@ def valid_email(email):
# Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation # Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation
if not re.search(r"^[\w.!#$%&'*+\\/=?^_`{|}~-]+@[\w](?:[\w-]{0,61}[\w])?(?:\.[\w](?:[\w-]{0,61}[\w])?)*$", if not re.search(r"^[\w.!#$%&'*+\\/=?^_`{|}~-]+@[\w](?:[\w-]{0,61}[\w])?(?:\.[\w](?:[\w-]{0,61}[\w])?)*$",
email): email):
log.error(u"Invalid e-mail address format") log.error(u"Invalid Email address format")
raise Exception(_(u"Invalid e-mail address format")) raise Exception(_(u"Invalid Email address format"))
return email return email
# ################################# External interface ################################# # ################################# External interface #################################

View File

@ -59,7 +59,7 @@ def get_sidebar_config(kwargs=None):
"show_text": _('Show Top Rated Books'), "config_show": True}) "show_text": _('Show Top Rated Books'), "config_show": True})
sidebar.append({"glyph": "glyphicon-eye-open", "text": _('Read Books'), "link": 'web.books_list', "id": "read", sidebar.append({"glyph": "glyphicon-eye-open", "text": _('Read Books'), "link": 'web.books_list', "id": "read",
"visibility": constants.SIDEBAR_READ_AND_UNREAD, 'public': (not g.user.is_anonymous), "visibility": constants.SIDEBAR_READ_AND_UNREAD, 'public': (not g.user.is_anonymous),
"page": "read", "show_text": _('Show read and unread'), "config_show": content}) "page": "read", "show_text": _('Show Read and Unread'), "config_show": content})
sidebar.append( sidebar.append(
{"glyph": "glyphicon-eye-close", "text": _('Unread Books'), "link": 'web.books_list', "id": "unread", {"glyph": "glyphicon-eye-close", "text": _('Unread Books'), "link": 'web.books_list', "id": "unread",
"visibility": constants.SIDEBAR_READ_AND_UNREAD, 'public': (not g.user.is_anonymous), "page": "unread", "visibility": constants.SIDEBAR_READ_AND_UNREAD, 'public': (not g.user.is_anonymous), "page": "unread",
@ -69,31 +69,31 @@ def get_sidebar_config(kwargs=None):
"show_text": _('Show Random Books'), "config_show": True}) "show_text": _('Show Random Books'), "config_show": True})
sidebar.append({"glyph": "glyphicon-inbox", "text": _('Categories'), "link": 'web.category_list', "id": "cat", sidebar.append({"glyph": "glyphicon-inbox", "text": _('Categories'), "link": 'web.category_list', "id": "cat",
"visibility": constants.SIDEBAR_CATEGORY, 'public': True, "page": "category", "visibility": constants.SIDEBAR_CATEGORY, 'public': True, "page": "category",
"show_text": _('Show category selection'), "config_show": True}) "show_text": _('Show Category Section'), "config_show": True})
sidebar.append({"glyph": "glyphicon-bookmark", "text": _('Series'), "link": 'web.series_list', "id": "serie", sidebar.append({"glyph": "glyphicon-bookmark", "text": _('Series'), "link": 'web.series_list', "id": "serie",
"visibility": constants.SIDEBAR_SERIES, 'public': True, "page": "series", "visibility": constants.SIDEBAR_SERIES, 'public': True, "page": "series",
"show_text": _('Show series selection'), "config_show": True}) "show_text": _('Show Series Section'), "config_show": True})
sidebar.append({"glyph": "glyphicon-user", "text": _('Authors'), "link": 'web.author_list', "id": "author", sidebar.append({"glyph": "glyphicon-user", "text": _('Authors'), "link": 'web.author_list', "id": "author",
"visibility": constants.SIDEBAR_AUTHOR, 'public': True, "page": "author", "visibility": constants.SIDEBAR_AUTHOR, 'public': True, "page": "author",
"show_text": _('Show author selection'), "config_show": True}) "show_text": _('Show Author Section'), "config_show": True})
sidebar.append( sidebar.append(
{"glyph": "glyphicon-text-size", "text": _('Publishers'), "link": 'web.publisher_list', "id": "publisher", {"glyph": "glyphicon-text-size", "text": _('Publishers'), "link": 'web.publisher_list', "id": "publisher",
"visibility": constants.SIDEBAR_PUBLISHER, 'public': True, "page": "publisher", "visibility": constants.SIDEBAR_PUBLISHER, 'public': True, "page": "publisher",
"show_text": _('Show publisher selection'), "config_show":True}) "show_text": _('Show Publisher Section'), "config_show":True})
sidebar.append({"glyph": "glyphicon-flag", "text": _('Languages'), "link": 'web.language_overview', "id": "lang", sidebar.append({"glyph": "glyphicon-flag", "text": _('Languages'), "link": 'web.language_overview', "id": "lang",
"visibility": constants.SIDEBAR_LANGUAGE, 'public': (g.user.filter_language() == 'all'), "visibility": constants.SIDEBAR_LANGUAGE, 'public': (g.user.filter_language() == 'all'),
"page": "language", "page": "language",
"show_text": _('Show language selection'), "config_show": True}) "show_text": _('Show Language Section'), "config_show": True})
sidebar.append({"glyph": "glyphicon-star-empty", "text": _('Ratings'), "link": 'web.ratings_list', "id": "rate", sidebar.append({"glyph": "glyphicon-star-empty", "text": _('Ratings'), "link": 'web.ratings_list', "id": "rate",
"visibility": constants.SIDEBAR_RATING, 'public': True, "visibility": constants.SIDEBAR_RATING, 'public': True,
"page": "rating", "show_text": _('Show ratings selection'), "config_show": True}) "page": "rating", "show_text": _('Show Ratings Section'), "config_show": True})
sidebar.append({"glyph": "glyphicon-file", "text": _('File formats'), "link": 'web.formats_list', "id": "format", sidebar.append({"glyph": "glyphicon-file", "text": _('File formats'), "link": 'web.formats_list', "id": "format",
"visibility": constants.SIDEBAR_FORMAT, 'public': True, "visibility": constants.SIDEBAR_FORMAT, 'public': True,
"page": "format", "show_text": _('Show file formats selection'), "config_show": True}) "page": "format", "show_text": _('Show File Formats Section'), "config_show": True})
sidebar.append( sidebar.append(
{"glyph": "glyphicon-trash", "text": _('Archived Books'), "link": 'web.books_list', "id": "archived", {"glyph": "glyphicon-trash", "text": _('Archived Books'), "link": 'web.books_list', "id": "archived",
"visibility": constants.SIDEBAR_ARCHIVED, 'public': (not g.user.is_anonymous), "page": "archived", "visibility": constants.SIDEBAR_ARCHIVED, 'public': (not g.user.is_anonymous), "page": "archived",
"show_text": _('Show archived books'), "config_show": content}) "show_text": _('Show Archived Books'), "config_show": content})
if not simple: if not simple:
sidebar.append( sidebar.append(
{"glyph": "glyphicon-th-list", "text": _('Books List'), "link": 'web.books_table', "id": "list", {"glyph": "glyphicon-th-list", "text": _('Books List'), "link": 'web.books_table', "id": "list",

26
cps/templates/admin.html Executable file → Normal file
View File

@ -11,8 +11,8 @@
<table class="table table-striped" id="table_user"> <table class="table table-striped" id="table_user">
<tr> <tr>
<th>{{_('Username')}}</th> <th>{{_('Username')}}</th>
<th>{{_('E-mail Address')}}</th> <th>{{_('Email')}}</th>
<th>{{_('Send to E-Reader E-mail Address')}}</th> <th>{{_('Send to eReader Email')}}</th>
<th>{{_('Downloads')}}</th> <th>{{_('Downloads')}}</th>
<th class="hidden-xs ">{{_('Admin')}}</th> <th class="hidden-xs ">{{_('Admin')}}</th>
<th class="hidden-xs hidden-sm">{{_('Password')}}</th> <th class="hidden-xs hidden-sm">{{_('Password')}}</th>
@ -59,7 +59,7 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h2>{{_('E-mail Server Settings')}}</h2> <h2>{{_('Email Server Settings')}}</h2>
{% if config.get_mail_server_configured() %} {% if config.get_mail_server_configured() %}
{% if email.mail_server_type == 0 %} {% if email.mail_server_type == 0 %}
<div class="col-xs-12 col-sm-12"> <div class="col-xs-12 col-sm-12">
@ -80,24 +80,24 @@
<div class="col-xs-6 col-sm-3">{{email.mail_login}}</div> <div class="col-xs-6 col-sm-3">{{email.mail_login}}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-3">{{_('From E-mail')}}</div> <div class="col-xs-6 col-sm-3">{{_('From Email')}}</div>
<div class="col-xs-6 col-sm-3">{{email.mail_from}}</div> <div class="col-xs-6 col-sm-3">{{email.mail_from}}</div>
</div> </div>
</div> </div>
{% else %} {% else %}
<div class="col-xs-12 col-sm-12"> <div class="col-xs-12 col-sm-12">
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-3">{{_('E-Mail Service')}}</div> <div class="col-xs-6 col-sm-3">{{_('Email Service')}}</div>
<div class="col-xs-6 col-sm-3">{{_('Gmail via Oauth2')}}</div> <div class="col-xs-6 col-sm-3">{{_('Gmail via Oauth2')}}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-3">{{_('From E-mail')}}</div> <div class="col-xs-6 col-sm-3">{{_('From Email')}}</div>
<div class="col-xs-6 col-sm-3">{{email.mail_gmail_token['email']}}</div> <div class="col-xs-6 col-sm-3">{{email.mail_gmail_token['email']}}</div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
<a class="btn btn-default emailconfig" id="admin_edit_email" href="{{url_for('admin.edit_mailsettings')}}">{{_('Edit E-mail Server Settings')}}</a> <a class="btn btn-default emailconfig" id="admin_edit_email" href="{{url_for('admin.edit_mailsettings')}}">{{_('Edit Email Server Settings')}}</a>
</div> </div>
</div> </div>
@ -167,15 +167,15 @@
<h2>{{_('Scheduled Tasks')}}</h2> <h2>{{_('Scheduled Tasks')}}</h2>
<div class="col-xs-12 col-sm-12 scheduled_tasks_details"> <div class="col-xs-12 col-sm-12 scheduled_tasks_details">
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-3">{{_('Time at which tasks start to run')}}</div> <div class="col-xs-6 col-sm-3">{{_('Start Time')}}</div>
<div class="col-xs-6 col-sm-3">{{schedule_time}}</div> <div class="col-xs-6 col-sm-3">{{schedule_time}}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-3">{{_('Maximum tasks duration')}}</div> <div class="col-xs-6 col-sm-3">{{_('Maximum Duration')}}</div>
<div class="col-xs-6 col-sm-3">{{schedule_duration}}</div> <div class="col-xs-6 col-sm-3">{{schedule_duration}}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-3">{{_('Generate book cover thumbnails')}}</div> <div class="col-xs-6 col-sm-3">{{_('Generate Thumbnails')}}</div>
<div class="col-xs-6 col-sm-3">{{ display_bool_setting(config.schedule_generate_book_covers) }}</div> <div class="col-xs-6 col-sm-3">{{ display_bool_setting(config.schedule_generate_book_covers) }}</div>
</div> </div>
<!--div class="row"> <!--div class="row">
@ -183,14 +183,14 @@
<div class="col-xs-6 col-sm-3">{{ display_bool_setting(config.schedule_generate_series_covers) }}</div> <div class="col-xs-6 col-sm-3">{{ display_bool_setting(config.schedule_generate_series_covers) }}</div>
</div--> </div-->
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-3">{{_('Reconnect to Calibre Library')}}</div> <div class="col-xs-6 col-sm-3">{{_('Reconnect Calibre Database')}}</div>
<div class="col-xs-6 col-sm-3">{{ display_bool_setting(config.schedule_reconnect) }}</div> <div class="col-xs-6 col-sm-3">{{ display_bool_setting(config.schedule_reconnect) }}</div>
</div> </div>
</div> </div>
<a class="btn btn-default scheduledtasks" id="admin_edit_scheduled_tasks" href="{{url_for('admin.edit_scheduledtasks')}}">{{_('Edit Scheduled Tasks Settings')}}</a> <a class="btn btn-default scheduledtasks" id="admin_edit_scheduled_tasks" href="{{url_for('admin.edit_scheduledtasks')}}">{{_('Edit Scheduled Tasks Settings')}}</a>
{% if config.schedule_generate_book_covers %} {% if config.schedule_generate_book_covers %}
<a class="btn btn-default" id="admin_refresh_cover_cache">{{_('Refresh Thumbnail Cover Cache')}}</a> <a class="btn btn-default" id="admin_refresh_cover_cache">{{_('Refresh Thumbnail Cache')}}</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -224,7 +224,7 @@
<tbody> <tbody>
<tr id="current_version"> <tr id="current_version">
<td>{{commit}} </td> <td>{{commit}} </td>
<td><i>{{_('Current version')}}</i></td> <td><i>{{_('Current Version')}}</i></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -124,7 +124,7 @@
<div data-related="register_settings"> <div data-related="register_settings">
<div class="form-group intend-form"> <div class="form-group intend-form">
<input type="checkbox" id="config_register_email" name="config_register_email" {% if config.config_register_email %}checked{% endif %}> <input type="checkbox" id="config_register_email" name="config_register_email" {% if config.config_register_email %}checked{% endif %}>
<label for="config_register_email">{{_('Use E-Mail as Username')}}</label> <label for="config_register_email">{{_('Use Email as Username')}}</label>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

6
cps/templates/detail.html Executable file → Normal file
View File

@ -10,7 +10,7 @@
</div> </div>
<div class="col-sm-9 col-lg-9 book-meta"> <div class="col-sm-9 col-lg-9 book-meta">
<div class="btn-toolbar" role="toolbar"> <div class="btn-toolbar" role="toolbar">
<div class="btn-group" role="group" aria-label="Download, send to E-Reader, reading"> <div class="btn-group" role="group" aria-label="Download, send to eReader, reading">
{% if g.user.role_download() %} {% if g.user.role_download() %}
{% if entry.data|length %} {% if entry.data|length %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
@ -39,11 +39,11 @@
{% endif %} {% endif %}
{% if g.user.kindle_mail and entry.email_share_list %} {% if g.user.kindle_mail and entry.email_share_list %}
{% if entry.email_share_list.__len__() == 1 %} {% if entry.email_share_list.__len__() == 1 %}
<div id="sendbtn" data-action="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=entry.email_share_list[0]['format'], convert=entry.email_share_list[0]['convert'])}}" data-text="{{_('Send to E-Reader')}}" class="btn btn-primary postAction" role="button"><span class="glyphicon glyphicon-send"></span> {{entry.email_share_list[0]['text']}}</div> <div id="sendbtn" data-action="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=entry.email_share_list[0]['format'], convert=entry.email_share_list[0]['convert'])}}" data-text="{{_('Send to eReader')}}" class="btn btn-primary postAction" role="button"><span class="glyphicon glyphicon-send"></span> {{entry.email_share_list[0]['text']}}</div>
{% else %} {% else %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button id="sendbtn2" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button id="sendbtn2" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-send"></span>{{_('Send to E-Reader')}} <span class="glyphicon glyphicon-send"></span>{{_('Send to eReader')}}
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="send-to-ereader"> <ul class="dropdown-menu" aria-labelledby="send-to-ereader">

View File

@ -10,16 +10,16 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if feature_support['gmail'] %} {% if feature_support['gmail'] %}
<div class="form-group"> <div class="form-group">
<label for="config_email_type">{{_('Choose Server Type')}}</label> <label for="config_email_type">{{_('Email Account Type')}}</label>
<select name="mail_server_type" id="config_email_type" class="form-control" data-control="email-settings"> <select name="mail_server_type" id="config_email_type" class="form-control" data-control="email-settings">
<option value="0" {% if content.mail_server_type == 0 %}selected{% endif %}>{{_('Use Standard E-Mail Account')}}</option> <option value="0" {% if content.mail_server_type == 0 %}selected{% endif %}>{{_('Standard Email Account')}}</option>
<option value="1" {% if content.mail_server_type == 1 %}selected{% endif %}>{{_('Gmail Account with OAuth2 Verification')}}</option> <option value="1" {% if content.mail_server_type == 1 %}selected{% endif %}>{{_('Gmail Account')}}</option>
</select> </select>
</div> </div>
<div data-related="email-settings-1"> <div data-related="email-settings-1">
<div class="form-group"> <div class="form-group">
{% if content.mail_gmail_token == {} %} {% if content.mail_gmail_token == {} %}
<button type="submit" id="gmail_server" name="gmail" value="submit" class="btn btn-default">{{_('Setup Gmail Account as E-Mail Server')}}</button> <button type="submit" id="gmail_server" name="gmail" value="submit" class="btn btn-default">{{_('Setup Gmail Account')}}</button>
{% else %} {% else %}
<button type="submit" id="invalidate_server" name="invalidate" value="submit" class="btn btn-danger">{{_('Revoke Gmail Access')}}</button> <button type="submit" id="invalidate_server" name="invalidate" value="submit" class="btn btn-danger">{{_('Revoke Gmail Access')}}</button>
{% endif %} {% endif %}
@ -52,7 +52,7 @@
<input type="password" class="form-control" name="mail_password" id="mail_password" value="{{content.mail_password}}"> <input type="password" class="form-control" name="mail_password" id="mail_password" value="{{content.mail_password}}">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="mail_from">{{_('From E-mail')}}</label> <label for="mail_from">{{_('From Email')}}</label>
<input type="text" class="form-control" name="mail_from" id="mail_from" value="{{content.mail_from}}" required> <input type="text" class="form-control" name="mail_from" id="mail_from" value="{{content.mail_from}}" required>
</div> </div>
<label for="mail_size">{{_('Attachment Size Limit')}}</label> <label for="mail_size">{{_('Attachment Size Limit')}}</label>
@ -63,7 +63,7 @@
</span> </span>
</div> </div>
<button type="submit" name="submit" value="submit" class="btn btn-default">{{_('Save')}}</button> <button type="submit" name="submit" value="submit" class="btn btn-default">{{_('Save')}}</button>
<button type="submit" name="test" value="test" class="btn btn-default">{{_('Save and Send Test E-mail')}}</button> <button type="submit" name="test" value="test" class="btn btn-default">{{_('Save and Send Test Email')}}</button>
{% if feature_support['gmail'] %} {% if feature_support['gmail'] %}
</div> </div>
{% endif %} {% endif %}

View File

@ -11,8 +11,8 @@
</div> </div>
{% endif %} {% endif %}
<div class="form-group required"> <div class="form-group required">
<label for="email">{{_('E-mail Address')}}</label> <label for="email">{{_('Email')}}</label>
<input type="email" class="form-control" id="email" name="email" placeholder="{{_('Your email address')}}" required> <input type="email" class="form-control" id="email" name="email" placeholder="{{_('Your Email')}}" required>
</div> </div>
<button type="submit" id="submit" class="btn btn-primary">{{_('Register')}}</button> <button type="submit" id="submit" class="btn btn-primary">{{_('Register')}}</button>
{% if config.config_use_github_oauth %} {% if config.config_use_github_oauth %}

View File

@ -9,7 +9,7 @@
<form role="form" class="col-md-10 col-lg-6" method="POST" autocomplete="off"> <form role="form" class="col-md-10 col-lg-6" method="POST" autocomplete="off">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="form-group"> <div class="form-group">
<label for="schedule_start_time">{{_('Time at which tasks start to run')}}</label> <label for="schedule_start_time">{{_('Start Time')}}</label>
<select name="schedule_start_time" id="schedule_start_time" class="form-control"> <select name="schedule_start_time" id="schedule_start_time" class="form-control">
{% for n in starttime %} {% for n in starttime %}
<option value="{{n[0]}}" {% if config.schedule_start_time == n[0] %}selected{% endif %}>{{n[1]}}</option> <option value="{{n[0]}}" {% if config.schedule_start_time == n[0] %}selected{% endif %}>{{n[1]}}</option>
@ -17,7 +17,7 @@
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="schedule_duration">{{_('Maximum tasks duration')}}</label> <label for="schedule_duration">{{_('Maximum Duration')}}</label>
<select name="schedule_duration" id="schedule_duration" class="form-control"> <select name="schedule_duration" id="schedule_duration" class="form-control">
{% for n in duration %} {% for n in duration %}
<option value="{{n[0]}}" {% if config.schedule_duration == n[0] %}selected{% endif %}>{{n[1]}}</option> <option value="{{n[0]}}" {% if config.schedule_duration == n[0] %}selected{% endif %}>{{n[1]}}</option>
@ -26,7 +26,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="checkbox" id="schedule_generate_book_covers" name="schedule_generate_book_covers" {% if config.schedule_generate_book_covers %}checked{% endif %}> <input type="checkbox" id="schedule_generate_book_covers" name="schedule_generate_book_covers" {% if config.schedule_generate_book_covers %}checked{% endif %}>
<label for="schedule_generate_book_covers">{{_('Generate Book Cover Thumbnails')}}</label> <label for="schedule_generate_book_covers">{{_('Generate Thumbnails')}}</label>
</div> </div>
<!--div class="form-group"> <!--div class="form-group">
<input type="checkbox" id="schedule_generate_series_covers" name="schedule_generate_series_covers" {% if config.schedule_generate_series_covers %}checked{% endif %}> <input type="checkbox" id="schedule_generate_series_covers" name="schedule_generate_series_covers" {% if config.schedule_generate_series_covers %}checked{% endif %}>
@ -34,7 +34,7 @@
</div--> </div-->
<div class="form-group"> <div class="form-group">
<input type="checkbox" id="schedule_reconnect" name="schedule_reconnect" {% if config.schedule_reconnect %}checked{% endif %}> <input type="checkbox" id="schedule_reconnect" name="schedule_reconnect" {% if config.schedule_reconnect %}checked{% endif %}>
<label for="schedule_reconnect">{{_('Reconnect to Calibre Library')}}</label> <label for="schedule_reconnect">{{_('Reconnect Calibre Database')}}</label>
</div> </div>
<button type="submit" name="submit" value="submit" class="btn btn-default">{{_('Save')}}</button> <button type="submit" name="submit" value="submit" class="btn btn-default">{{_('Save')}}</button>

0
cps/templates/shelfdown.html Executable file → Normal file
View File

4
cps/templates/user_edit.html Executable file → Normal file
View File

@ -12,7 +12,7 @@
</div> </div>
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">
<label for="email">{{_('E-mail Address')}}</label> <label for="email">{{_('Email')}}</label>
<input type="email" class="form-control" name="email" id="email" value="{{ content.email if content.email != None }}" autocomplete="off"> <input type="email" class="form-control" name="email" id="email" value="{{ content.email if content.email != None }}" autocomplete="off">
</div> </div>
{% if ( g.user and g.user.role_passwd() or g.user.role_admin() ) and not content.role_anonymous() %} {% if ( g.user and g.user.role_passwd() or g.user.role_admin() ) and not content.role_anonymous() %}
@ -25,7 +25,7 @@
</div> </div>
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">
<label for="kindle_mail">{{_('Send to E-Reader E-mail Address')}}</label> <label for="kindle_mail">{{_('Send to eReader Email')}}</label>
<input type="email" class="form-control" name="kindle_mail" id="kindle_mail" value="{{ content.kindle_mail if content.kindle_mail != None }}"> <input type="email" class="form-control" name="kindle_mail" id="kindle_mail" value="{{ content.kindle_mail if content.kindle_mail != None }}">
</div> </div>
{% if not content.role_anonymous() %} {% if not content.role_anonymous() %}

26
cps/templates/user_table.html Executable file → Normal file
View File

@ -121,7 +121,7 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="col-xs-12 col-sm-12"> <div class="col-xs-12 col-sm-12">
<div class="row"> <div class="row">
<div class="btn btn-default disabled" id="user_delete_selection" aria-disabled="true">{{_('Remove Selections')}}</div> <div class="btn btn-default disabled" id="user_delete_Section" aria-disabled="true">{{_('Remove Sections')}}</div>
</div> </div>
</div> </div>
<table id="user-table" class="table table-no-bordered table-striped" <table id="user-table" class="table table-no-bordered table-striped"
@ -132,8 +132,8 @@
<th data-name="state" data-field="state" data-checkbox="true" data-visible="{{visiblility.get('state')}}" data-sortable="true"></th> <th data-name="state" data-field="state" data-checkbox="true" data-visible="{{visiblility.get('state')}}" data-sortable="true"></th>
<th data-name="id" data-field="id" id="id" data-visible="false" data-switchable="false"></th> <th data-name="id" data-field="id" id="id" data-visible="false" data-switchable="false"></th>
{{ user_table_row('name', _('Enter Username'), _('Username'), true) }} {{ user_table_row('name', _('Enter Username'), _('Username'), true) }}
{{ user_table_row('email', _('Enter E-mail Address'), _('E-mail Address'), true) }} {{ user_table_row('email', _('Enter Email'), _('Email'), true) }}
{{ user_table_row('kindle_mail', _('Enter E-Reader E-mail Address'), _('E-Reader E-mail'), false) }} {{ user_table_row('kindle_mail', _('Enter eReader Email'), _('eReader Email'), false) }}
{{ user_select_translations('locale', url_for('admin.table_get_locale'), _('Locale'), true) }} {{ user_select_translations('locale', url_for('admin.table_get_locale'), _('Locale'), true) }}
{{ user_select_languages('default_language', url_for('admin.table_get_default_lang'), _('Visible Book Languages'), true) }} {{ user_select_languages('default_language', url_for('admin.table_get_default_lang'), _('Visible Book Languages'), true) }}
{{ user_table_row('allowed_tags', _("Edit Allowed Tags"), _("Allowed Tags"), false, tags) }} {{ user_table_row('allowed_tags', _("Edit Allowed Tags"), _("Allowed Tags"), false, tags) }}
@ -152,18 +152,18 @@
{{ user_single_checkbox_row("kobo_only_shelves_sync", _('Sync selected Shelves with Kobo'))}} {{ user_single_checkbox_row("kobo_only_shelves_sync", _('Sync selected Shelves with Kobo'))}}
{% endif %} {% endif %}
{{ user_checkbox_row("sidebar_view", "detail_random", _('Show Random Books in Detail View'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "detail_random", _('Show Random Books in Detail View'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_language", _('Show language selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_language", _('Show Language Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_read_and_unread", _('Show read/unread selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_read_and_unread", _('Show Read/Unread Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_series", _('Show series selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_series", _('Show Series Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_category", _('Show category selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_category", _('Show Category Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_random", _('Show random books'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_random", _('Show Random Books'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_author", _('Show author selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_author", _('Show Author Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_best_rated", _('Show Top Rated Books'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_best_rated", _('Show Top Rated Books'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_read_and_unread", _('Show Random Books'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_read_and_unread", _('Show Random Books'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_publisher", _('Show publisher selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_publisher", _('Show Publisher Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_rating", _('Show ratings selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_rating", _('Show Ratings Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_format", _('Show file formats selection'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_format", _('Show File Formats Section'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_archived", _('Show archived books'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_archived", _('Show Archived Books'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_download", _('Show Downloaded Books'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_download", _('Show Downloaded Books'), visiblility, sidebar_settings)}}
{{ user_checkbox_row("sidebar_view", "sidebar_list", _('Show Books List'), visiblility, sidebar_settings)}} {{ user_checkbox_row("sidebar_view", "sidebar_list", _('Show Books List'), visiblility, sidebar_settings)}}
<th data-align="right" data-formatter="UserActions" data-switchable="false"><div><div class="btn btn-default button_head disabled" aria-disabled="true">{{_('Delete User')}}</div></div><br>{{_('Delete User')}}</th> <th data-align="right" data-formatter="UserActions" data-switchable="false"><div><div class="btn btn-default button_head disabled" aria-disabled="true">{{_('Delete User')}}</div></div><br>{{_('Delete User')}}</th>

66
cps/web.py Executable file → Normal file
View File

@ -514,7 +514,7 @@ def render_author_books(page, author_id, order):
db.books_series_link.c.book == db.Books.id, db.books_series_link.c.book == db.Books.id,
db.Series) db.Series)
if entries is None or not len(entries): if entries is None or not len(entries):
flash(_(u"Oops! Selected book title is unavailable. File does not exist or is not accessible"), flash(_(u"Oops! Selected book is unavailable. File does not exist or is not accessible"),
category="error") category="error")
return redirect(url_for("web.index")) return redirect(url_for("web.index"))
if constants.sqlalchemy_version2: if constants.sqlalchemy_version2:
@ -1195,18 +1195,18 @@ def download_link(book_id, book_format, anyname):
@download_required @download_required
def send_to_ereader(book_id, book_format, convert): def send_to_ereader(book_id, book_format, convert):
if not config.get_mail_server_configured(): if not config.get_mail_server_configured():
flash(_(u"Please configure the SMTP mail settings first..."), category="error") flash(_(u"Please configure the SMTP mail settings first."), category="error")
elif current_user.kindle_mail: elif current_user.eReader_mail:
result = send_mail(book_id, book_format, convert, current_user.kindle_mail, config.config_calibre_dir, result = send_mail(book_id, book_format, convert, current_user.eReader_mail, config.config_calibre_dir,
current_user.name) current_user.name)
if result is None: if result is None:
flash(_(u"Book successfully queued for sending to %(kindlemail)s", kindlemail=current_user.kindle_mail), flash(_(u"Success! Book queued for sending to %(eReadermail)s", eReadermail=current_user.eReader_mail),
category="success") category="success")
ub.update_download(book_id, int(current_user.id)) ub.update_download(book_id, int(current_user.id))
else: else:
flash(_(u"Oops! There was an error sending this book: %(res)s", res=result), category="error") flash(_(u"Oops! There was an error sending book: %(res)s", res=result), category="error")
else: else:
flash(_(u"Please update your profile with a valid Send to Kindle E-mail Address."), category="error") flash(_(u"Oops! Please update your profile with a valid eReader Email."), category="error")
if "HTTP_REFERER" in request.environ: if "HTTP_REFERER" in request.environ:
return redirect(request.environ["HTTP_REFERER"]) return redirect(request.environ["HTTP_REFERER"])
else: else:
@ -1223,14 +1223,14 @@ def register():
if current_user is not None and current_user.is_authenticated: if current_user is not None and current_user.is_authenticated:
return redirect(url_for('web.index')) return redirect(url_for('web.index'))
if not config.get_mail_server_configured(): if not config.get_mail_server_configured():
flash(_(u"E-Mail server is not configured, please contact your administrator!"), category="error") flash(_(u"Oops! Email server is not configured, please contact your administrator."), category="error")
return render_title_template('register.html', title=_("Register"), page="register") return render_title_template('register.html', title=_("Register"), page="register")
if request.method == "POST": if request.method == "POST":
to_save = request.form.to_dict() to_save = request.form.to_dict()
nickname = to_save.get("email", "").strip() if config.config_register_email else to_save.get('name') nickname = to_save.get("email", "").strip() if config.config_register_email else to_save.get('name')
if not nickname or not to_save.get("email"): if not nickname or not to_save.get("email"):
flash(_(u"Please fill out all fields!"), category="error") flash(_(u"Oops! Please complete all fields."), category="error")
return render_title_template('register.html', title=_("Register"), page="register") return render_title_template('register.html', title=_("Register"), page="register")
try: try:
nickname = check_username(nickname) nickname = check_username(nickname)
@ -1256,14 +1256,14 @@ def register():
send_registration_mail(to_save.get("email", "").strip(), nickname, password) send_registration_mail(to_save.get("email", "").strip(), nickname, password)
except Exception: except Exception:
ub.session.rollback() ub.session.rollback()
flash(_(u"An unknown error occurred. Please try again later."), category="error") flash(_(u"Oops! An unknown error occurred. Please try again later."), category="error")
return render_title_template('register.html', title=_("Register"), page="register") return render_title_template('register.html', title=_("Register"), page="register")
else: else:
flash(_(u"Your e-mail is not allowed to register"), category="error") flash(_(u"Oops! Your Email is not allowed."), category="error")
log.warning('Registering failed for user "{}" e-mail address: {}'.format(nickname, log.warning('Registering failed for user "{}" Email: {}'.format(nickname,
to_save.get("email",""))) to_save.get("email","")))
return render_title_template('register.html', title=_("Register"), page="register") return render_title_template('register.html', title=_("Register"), page="register")
flash(_(u"Confirmation e-mail was send to your e-mail account."), category="success") flash(_(u"Success! Confirmation Email has been sent."), category="success")
return redirect(url_for('web.login')) return redirect(url_for('web.login'))
if feature_support['oauth']: if feature_support['oauth']:
@ -1277,7 +1277,7 @@ def login():
return redirect(url_for('web.index')) return redirect(url_for('web.index'))
if config.config_login_type == constants.LOGIN_LDAP and not services.ldap: if config.config_login_type == constants.LOGIN_LDAP and not services.ldap:
log.error(u"Cannot activate LDAP authentication") log.error(u"Cannot activate LDAP authentication")
flash(_(u"Cannot activate LDAP authentication"), category="error") flash(_(u"Oops! Cannot activate LDAP authentication"), category="error")
if request.method == "POST": if request.method == "POST":
form = request.form.to_dict() form = request.form.to_dict()
user = ub.session.query(ub.User).filter(func.lower(ub.User.name) == form['username'].strip().lower()) \ user = ub.session.query(ub.User).filter(func.lower(ub.User.name) == form['username'].strip().lower()) \
@ -1288,7 +1288,7 @@ def login():
login_user(user, remember=bool(form.get('remember_me'))) login_user(user, remember=bool(form.get('remember_me')))
ub.store_user_session() ub.store_user_session()
log.debug(u"You are now logged in as: '{}'".format(user.name)) log.debug(u"You are now logged in as: '{}'".format(user.name))
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.name), flash(_(u"Success! You are now logged in as: %(nickname)s", nickname=user.name),
category="success") category="success")
return redirect_back(url_for("web.index")) return redirect_back(url_for("web.index"))
elif login_result is None and user and check_password_hash(str(user.password), form['password']) \ elif login_result is None and user and check_password_hash(str(user.password), form['password']) \
@ -1296,42 +1296,42 @@ def login():
login_user(user, remember=bool(form.get('remember_me'))) login_user(user, remember=bool(form.get('remember_me')))
ub.store_user_session() ub.store_user_session()
log.info("Local Fallback Login as: '{}'".format(user.name)) log.info("Local Fallback Login as: '{}'".format(user.name))
flash(_(u"Fallback Login as: '%(nickname)s', LDAP Server not reachable, or user not known", flash(_(u"Fallback Login as: %(nickname)s, LDAP Server not reachable, or user not known",
nickname=user.name), nickname=user.name),
category="warning") category="warning")
return redirect_back(url_for("web.index")) return redirect_back(url_for("web.index"))
elif login_result is None: elif login_result is None:
log.info(error) log.info(error)
flash(_(u"Could not login: %(message)s", message=error), category="error") flash(_(u"Oops! Login Failed: %(message)s", message=error), category="error")
else: else:
ip_address = request.headers.get('X-Forwarded-For', request.remote_addr) ip_address = request.headers.get('X-Forwarded-For', request.remote_addr)
log.warning('LDAP Login failed for user "%s" IP-address: %s', form['username'], ip_address) log.warning('LDAP Login failed for user "%s" IP-address: %s', form['username'], ip_address)
flash(_(u"Wrong Username or Password"), category="error") flash(_(u"Oops! Invalid Username or Password."), category="error")
else: else:
ip_address = request.headers.get('X-Forwarded-For', request.remote_addr) ip_address = request.headers.get('X-Forwarded-For', request.remote_addr)
if form.get('forgot', "") == 'forgot': if form.get('forgot', "") == 'forgot':
if user is not None and user.name != "Guest": if user is not None and user.name != "Guest":
ret, __ = reset_password(user.id) ret, __ = reset_password(user.id)
if ret == 1: if ret == 1:
flash(_(u"New Password was send to your email address"), category="info") flash(_(u"Success! New Password was sent to your Email."), category="info")
log.info('Password reset for user "%s" IP-address: %s', form['username'], ip_address) log.info('Password reset for user "%s" IP-address: %s', form['username'], ip_address)
else: else:
log.error(u"An unknown error occurred. Please try again later") log.error(u"An unknown error occurred. Please try again later")
flash(_(u"An unknown error occurred. Please try again later."), category="error") flash(_(u"Ops! An unknown error occurred. Please try again later."), category="error")
else: else:
flash(_(u"Please enter valid username to reset password"), category="error") flash(_(u"Oops! Please enter a valid username to reset password"), category="error")
log.warning('Username missing for password reset IP-address: %s', ip_address) log.warning('Username missing for password reset IP-address: %s', ip_address)
else: else:
if user and check_password_hash(str(user.password), form['password']) and user.name != "Guest": if user and check_password_hash(str(user.password), form['password']) and user.name != "Guest":
login_user(user, remember=bool(form.get('remember_me'))) login_user(user, remember=bool(form.get('remember_me')))
ub.store_user_session() ub.store_user_session()
log.debug(u"You are now logged in as: '%s'", user.name) log.debug(u"You are now logged in as: '%s'", user.name)
flash(_(u"You are now logged in as: '%(nickname)s'", nickname=user.name), category="success") flash(_(u"Success! You are now logged in as: %(nickname)s", nickname=user.name), category="success")
config.config_is_initial = False config.config_is_initial = False
return redirect_back(url_for("web.index")) return redirect_back(url_for("web.index"))
else: else:
log.warning('Login failed for user "{}" IP-address: {}'.format(form['username'], ip_address)) log.warning('Login failed for user "{}" IP-address: {}'.format(form['username'], ip_address))
flash(_(u"Wrong Username or Password"), category="error") flash(_(u"Oops! Invalid Username or Password."), category="error")
next_url = request.args.get('next', default=url_for("web.index"), type=str) next_url = request.args.get('next', default=url_for("web.index"), type=str)
if url_for("web.logout") == next_url: if url_for("web.logout") == next_url:
@ -1364,11 +1364,11 @@ def change_profile(kobo_support, local_oauth_check, oauth_status, translations,
if to_save.get("password"): if to_save.get("password"):
current_user.password = generate_password_hash(to_save.get("password")) current_user.password = generate_password_hash(to_save.get("password"))
try: try:
if to_save.get("kindle_mail", current_user.kindle_mail) != current_user.kindle_mail: if to_save.get("eReader_mail", current_user.eReader_mail) != current_user.eReader_mail:
current_user.kindle_mail = valid_email(to_save.get("kindle_mail")) current_user.eReader_mail = valid_email(to_save.get("eReader_mail"))
new_email = valid_email(to_save.get("email", current_user.email)) new_email = valid_email(to_save.get("email", current_user.email))
if not new_email: if not new_email:
raise Exception(_(u"E-Mail Address can't be empty and has to be a valid E-Mail")) raise Exception(_(u"Email can't be empty and has to be a valid Email"))
if new_email != current_user.email: if new_email != current_user.email:
current_user.email = check_email(new_email) current_user.email = check_email(new_email)
if current_user.role_admin(): if current_user.role_admin():
@ -1393,7 +1393,7 @@ def change_profile(kobo_support, local_oauth_check, oauth_status, translations,
translations=translations, translations=translations,
profile=1, profile=1,
languages=languages, languages=languages,
title=_(u"%(name)s's profile", name=current_user.name), title=_(u"%(name)s's Profile", name=current_user.name),
page="me", page="me",
kobo_support=kobo_support, kobo_support=kobo_support,
registered_oauth=local_oauth_check, registered_oauth=local_oauth_check,
@ -1409,16 +1409,16 @@ def change_profile(kobo_support, local_oauth_check, oauth_status, translations,
try: try:
ub.session.commit() ub.session.commit()
flash(_(u"Profile updated"), category="success") flash(_(u"Success! Profile Updated"), category="success")
log.debug(u"Profile updated") log.debug(u"Profile Updated")
except IntegrityError: except IntegrityError:
ub.session.rollback() ub.session.rollback()
flash(_(u"Found an existing account for this e-mail address"), category="error") flash(_(u"Oops! An account already exists for this Email."), category="error")
log.debug(u"Found an existing account for this e-mail address") log.debug(u"Found an existing account for this Email")
except OperationalError as e: except OperationalError as e:
ub.session.rollback() ub.session.rollback()
log.error("Database error: %s", e) log.error("Database error: %s", e)
flash(_(u"Database error: %(error)s.", error=e), category="error") flash(_(u"Oops! Database Error: %(error)s.", error=e), category="error")
@web.route("/me", methods=["GET", "POST"]) @web.route("/me", methods=["GET", "POST"])
@ -1442,7 +1442,7 @@ def profile():
languages=languages, languages=languages,
content=current_user, content=current_user,
kobo_support=kobo_support, kobo_support=kobo_support,
title=_(u"%(name)s's profile", name=current_user.name), title=_(u"%(name)s's Profile", name=current_user.name),
page="me", page="me",
registered_oauth=local_oauth_check, registered_oauth=local_oauth_check,
oauth_status=oauth_status) oauth_status=oauth_status)