mirror of
https://github.com/janeczku/calibre-web
synced 2025-10-19 17:47:39 +00:00
Merge branch 'master' into Develop
This commit is contained in:
@@ -125,7 +125,7 @@ def send_registration_mail(e_mail, user_name, default_password, resend=False):
|
||||
if not resend:
|
||||
text += "Your new account at Calibre-Web has been created. Thanks for joining us!\r\n"
|
||||
text += "Please log in to your account using the following informations:\r\n"
|
||||
text += "User name: %s\n" % user_name
|
||||
text += "User name: %s\r\n" % user_name
|
||||
text += "Password: %s\r\n" % default_password
|
||||
text += "Don't forget to change your password after first login.\r\n"
|
||||
text += "Sincerely\r\n\r\n"
|
||||
@@ -416,6 +416,8 @@ def reset_password(user_id):
|
||||
existing_user = ub.session.query(ub.User).filter(ub.User.id == user_id).first()
|
||||
password = generate_random_password()
|
||||
existing_user.password = generate_password_hash(password)
|
||||
if not config.get_mail_server_configured():
|
||||
return (2, None)
|
||||
try:
|
||||
ub.session.commit()
|
||||
send_registration_mail(existing_user.email, existing_user.nickname, password, True)
|
||||
@@ -735,9 +737,13 @@ def speaking_language(languages=None):
|
||||
# from https://code.luasoftware.com/tutorials/flask/execute-raw-sql-in-flask-sqlalchemy/
|
||||
def check_valid_domain(domain_text):
|
||||
domain_text = domain_text.split('@', 1)[-1].lower()
|
||||
sql = "SELECT * FROM registration WHERE :domain LIKE domain;"
|
||||
sql = "SELECT * FROM registration WHERE (:domain LIKE domain and allow = 1);"
|
||||
result = ub.session.query(ub.Registration).from_statement(text(sql)).params(domain=domain_text).all()
|
||||
return len(result)
|
||||
if not len(result):
|
||||
return False
|
||||
sql = "SELECT * FROM registration WHERE (:domain LIKE domain and allow = 0);"
|
||||
result = ub.session.query(ub.Registration).from_statement(text(sql)).params(domain=domain_text).all()
|
||||
return not len(result)
|
||||
|
||||
|
||||
# Orders all Authors in the list according to authors sort
|
||||
|
Reference in New Issue
Block a user