Commit b4d7733e authored by Ozzieisaacs's avatar Ozzieisaacs

Merge branch 'master' into Develop

# Conflicts:
#	cps/templates/list.html
#	cps/translations/cs/LC_MESSAGES/messages.po
#	cps/translations/de/LC_MESSAGES/messages.po
#	cps/translations/es/LC_MESSAGES/messages.po
#	cps/translations/fi/LC_MESSAGES/messages.po
#	cps/translations/fr/LC_MESSAGES/messages.po
#	cps/translations/hu/LC_MESSAGES/messages.po
#	cps/translations/it/LC_MESSAGES/messages.po
#	cps/translations/ja/LC_MESSAGES/messages.po
#	cps/translations/km/LC_MESSAGES/messages.po
#	cps/translations/nl/LC_MESSAGES/messages.po
#	cps/translations/pl/LC_MESSAGES/messages.po
#	cps/translations/ru/LC_MESSAGES/messages.po
#	cps/translations/sv/LC_MESSAGES/messages.po
#	cps/translations/uk/LC_MESSAGES/messages.po
#	cps/translations/zh_Hans_CN/LC_MESSAGES/messages.po
#	messages.pot
parents 8b8fe7a0 85ffc90f
## How to contribute to Calibre-Web
First of all, we would like to thank you for reading this text. we are happy you are willing to contribute to Calibre-Web
### **General**
**Communication language** is english. Google translated texts are not as bad as you might think, they are usually understandable, so don't worry if you generate your post that way.
**Calibre-Web** is not **Calibre**. If you are having a question regarding Calibre please post this at their [repository](https://github.com/kovidgoyal/calibre).
**Docker-Containers** of Calibre-Web are maintained by different persons than the people who drive Calibre-Web. If we come to the conclusion during our analysis that the problem is related to Docker, we might ask you to open a new issue at the reprository of the Docker Container.
If you are having **Basic Installation Problems** with python or it's dependencies, please consider using your favorite search engine to find a solution. In case you can't find a solution, we are happy to help you.
We can offer only very limited support regarding configuration of **Reverse-Proxy Installations**, **OPDS-Reader** or other programs in combination with Calibre-Web.
### **Translation**
Some of the user languages in Calibre-Web having missing translations. We are happy to add the missing texts if you are translate them. Create a Pull Request, create an issue with the .po file attached, or write an email to "ozzie.fernandez.isaacs@googlemail.com" with attached translation file. To display all book languages in your native language an additional file is used (iso_language_names.py). The content of this file is autogenerated with the corresponding translations of Calibre, please do not edit this file on your own.
### **Documentation**
The Calibre-Web documentation is hosted in the Github [Wiki](https://github.com/janeczku/calibre-web/wiki). The Wiki is open to everybody, if you find a problem, feel free to correct it. If information is missing, you are welcome to add it. The content will be reviewed time by time. Please try to be consitent with the form with the other Wiki pages (e.g. the project name is Calibre-Web with 2 capital letters and a dash in between).
### **Reporting a bug**
Do not open up a GitHub issue if the bug is a **security vulnerability** in Calibre-Web. Please write intead an email to "ozzie.fernandez.isaacs@googlemail.com".
Ensure the ***bug was not already reported** by searching on GitHub under [Issues](https://github.com/janeczku/calibre-web/issues). Please also check if a solution for your problem can be found in the [wiki](https://github.com/janeczku/calibre-web/wiki).
If you're unable to find an **open issue** addressing the problem, open a [new one](https://github.com/janeczku/calibre-web/issues/new?assignees=&labels=&template=bug_report.md&title=). Be sure to include a **title** and **clear description**, as much relevant information as possible, the **issue form** helps you providing the right information. Deleting the form and just pasting the stack trace doesn't speed up fixing the problem. If your issue could be resolved, consider closing the issue.
### **Feature Request**
If there is afeature missing in Calibre-Web and you can't find a feature request in the [Issues](https://github.com/janeczku/calibre-web/issues) section, you could create a [feature request](https://github.com/janeczku/calibre-web/issues/new?assignees=&labels=&template=feature_request.md&title=).
We will not extend Calibre-Web with any more login abilitys or add further files storages, or file syncing ability. Furthermore Calibre-Web is made for home usage for company inhouse usage, so requests regarding any sorts of social interaction capability, payment routines, search engine or web site analytics integration will not be implemeted.
### **Contributing code to Calibre-Web**
Open a new GitHub pull request with the patch. Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
In case your code enhances features of Calibre-Web: Create your pull request for the development branch if your enhancement consits of more than some lines of code in a local section of Calibre-Webs code. This makes it easier to test it and check all implication before it's made public.
Please check if your code runs on Python 2.7 (still necessary in 2020) and mainly on python 3. If possible and the feature is related to operating system functions, try to check it on Windows and Linux.
Calibre-Web is automatically tested on Linux in combination with python 3.7. The code for testing is in a [seperate repo](https://github.com/OzzieIsaacs/calibre-web-test) on Github. It uses unittest and performs real system tests with selenium, would be great if you could consider also writing some tests.
A static code analysis is done by Codacy, but it's partly broken and doesn't run automatically. You could check your code with ESLint before contributing, a configuration file can be found in the projects root folder.
...@@ -12,7 +12,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d ...@@ -12,7 +12,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d
- full graphical setup - full graphical setup
- User management with fine-grained per-user permissions - User management with fine-grained per-user permissions
- Admin interface - Admin interface
- User Interface in czech, dutch, english, finnish, french, german, hungarian, italian, japanese, khmer, polish, russian, simplified chinese, spanish, swedish, ukrainian - User Interface in czech, dutch, english, finnish, french, german, hungarian, italian, japanese, khmer, polish, russian, simplified chinese, spanish, swedish, turkish, ukrainian
- OPDS feed for eBook reader apps - OPDS feed for eBook reader apps
- Filter and search by titles, authors, tags, series and language - Filter and search by titles, authors, tags, series and language
- Create a custom book collection (shelves) - Create a custom book collection (shelves)
......
...@@ -547,7 +547,7 @@ def _configuration_update_helper(): ...@@ -547,7 +547,7 @@ def _configuration_update_helper():
if config.config_login_type == constants.LOGIN_LDAP: if config.config_login_type == constants.LOGIN_LDAP:
reboot_required |= _config_string("config_ldap_provider_url") reboot_required |= _config_string("config_ldap_provider_url")
reboot_required |= _config_int("config_ldap_port") reboot_required |= _config_int("config_ldap_port")
# _config_string("config_ldap_schema") reboot_required |= _config_int("config_ldap_authentication")
reboot_required |= _config_string("config_ldap_dn") reboot_required |= _config_string("config_ldap_dn")
reboot_required |= _config_string("config_ldap_serv_username") reboot_required |= _config_string("config_ldap_serv_username")
reboot_required |= _config_string("config_ldap_user_object") reboot_required |= _config_string("config_ldap_user_object")
...@@ -569,9 +569,13 @@ def _configuration_update_helper(): ...@@ -569,9 +569,13 @@ def _configuration_update_helper():
return _configuration_result(_('Please Enter a LDAP Provider, ' return _configuration_result(_('Please Enter a LDAP Provider, '
'Port, DN and User Object Identifier'), gdriveError) 'Port, DN and User Object Identifier'), gdriveError)
if config.config_ldap_authentication > constants.LDAP_AUTH_ANONYMOUS:
if not config.config_ldap_serv_username or not bool(config.config_ldap_serv_password): if config.config_ldap_authentication > constants.LDAP_AUTH_UNAUTHENTICATE:
return _configuration_result('Please Enter a LDAP Service Account and Password', gdriveError) if not config.config_ldap_serv_username or not bool(config.config_ldap_serv_password):
return _configuration_result('Please Enter a LDAP Service Account and Password', gdriveError)
else:
if not config.config_ldap_serv_username:
return _configuration_result('Please Enter a LDAP Service Account', gdriveError)
#_config_checkbox("config_ldap_use_ssl") #_config_checkbox("config_ldap_use_ssl")
#_config_checkbox("config_ldap_use_tls") #_config_checkbox("config_ldap_use_tls")
...@@ -830,9 +834,8 @@ def edit_user(user_id): ...@@ -830,9 +834,8 @@ def edit_user(user_id):
if request.method == "POST": if request.method == "POST":
to_save = request.form.to_dict() to_save = request.form.to_dict()
if "delete" in to_save: if "delete" in to_save:
if ub.session.query(ub.User).filter(and_(ub.User.role.op('&') if ub.session.query(ub.User).filter(ub.User.role.op('&')(constants.ROLE_ADMIN) == constants.ROLE_ADMIN,
(constants.ROLE_ADMIN)== constants.ROLE_ADMIN, ub.User.id != content.id).count():
ub.User.id != content.id)).count():
ub.session.query(ub.User).filter(ub.User.id == content.id).delete() ub.session.query(ub.User).filter(ub.User.id == content.id).delete()
ub.session.commit() ub.session.commit()
flash(_(u"User '%(nick)s' deleted", nick=content.nickname), category="success") flash(_(u"User '%(nick)s' deleted", nick=content.nickname), category="success")
...@@ -841,6 +844,12 @@ def edit_user(user_id): ...@@ -841,6 +844,12 @@ def edit_user(user_id):
flash(_(u"No admin user remaining, can't delete user", nick=content.nickname), category="error") flash(_(u"No admin user remaining, can't delete user", nick=content.nickname), category="error")
return redirect(url_for('admin.admin')) return redirect(url_for('admin.admin'))
else: else:
if not ub.session.query(ub.User).filter(ub.User.role.op('&')(constants.ROLE_ADMIN) == constants.ROLE_ADMIN,
ub.User.id != content.id).count() and \
not 'admin_role' in to_save:
flash(_(u"No admin user remaining, can't remove admin role", nick=content.nickname), category="error")
return redirect(url_for('admin.admin'))
if "password" in to_save and to_save["password"]: if "password" in to_save and to_save["password"]:
content.password = generate_password_hash(to_save["password"]) content.password = generate_password_hash(to_save["password"])
anonymous = content.is_anonymous anonymous = content.is_anonymous
......
...@@ -95,12 +95,10 @@ class _Settings(_Base): ...@@ -95,12 +95,10 @@ class _Settings(_Base):
config_ldap_provider_url = Column(String, default='example.org') config_ldap_provider_url = Column(String, default='example.org')
config_ldap_port = Column(SmallInteger, default=389) config_ldap_port = Column(SmallInteger, default=389)
# config_ldap_schema = Column(String, default='ldap') config_ldap_authentication = Column(SmallInteger, default=constants.LDAP_AUTH_SIMPLE)
config_ldap_serv_username = Column(String, default='cn=admin,dc=example,dc=org') config_ldap_serv_username = Column(String, default='cn=admin,dc=example,dc=org')
config_ldap_serv_password = Column(String, default="") config_ldap_serv_password = Column(String, default="")
config_ldap_encryption = Column(SmallInteger, default=0) config_ldap_encryption = Column(SmallInteger, default=0)
# config_ldap_use_tls = Column(Boolean, default=False)
# config_ldap_require_cert = Column(Boolean, default=False)
config_ldap_cert_path = Column(String, default="") config_ldap_cert_path = Column(String, default="")
config_ldap_dn = Column(String, default='dc=example,dc=org') config_ldap_dn = Column(String, default='dc=example,dc=org')
config_ldap_user_object = Column(String, default='uid=%s') config_ldap_user_object = Column(String, default='uid=%s')
......
...@@ -93,7 +93,10 @@ AUTO_UPDATE_NIGHTLY = 1 << 2 ...@@ -93,7 +93,10 @@ AUTO_UPDATE_NIGHTLY = 1 << 2
LOGIN_STANDARD = 0 LOGIN_STANDARD = 0
LOGIN_LDAP = 1 LOGIN_LDAP = 1
LOGIN_OAUTH = 2 LOGIN_OAUTH = 2
# LOGIN_OAUTH_GOOGLE = 3
LDAP_AUTH_ANONYMOUS = 0
LDAP_AUTH_UNAUTHENTICATE = 1
LDAP_AUTH_SIMPLE = 0
DEFAULT_MAIL_SERVER = "mail.example.org" DEFAULT_MAIL_SERVER = "mail.example.org"
......
This diff is collapsed.
...@@ -42,11 +42,17 @@ def init_app(app, config): ...@@ -42,11 +42,17 @@ def init_app(app, config):
app.config['LDAP_SCHEMA'] = 'ldaps' app.config['LDAP_SCHEMA'] = 'ldaps'
else: else:
app.config['LDAP_SCHEMA'] = 'ldap' app.config['LDAP_SCHEMA'] = 'ldap'
# app.config['LDAP_SCHEMA'] = config.config_ldap_schema if config.config_ldap_authentication > constants.LDAP_AUTH_ANONYMOUS:
app.config['LDAP_USERNAME'] = config.config_ldap_serv_username if config.config_ldap_authentication > constants.LDAP_AUTH_UNAUTHENTICATE:
if config.config_ldap_serv_password is None: if config.config_ldap_serv_password is None:
config.config_ldap_serv_password = '' config.config_ldap_serv_password = ''
app.config['LDAP_PASSWORD'] = base64.b64decode(config.config_ldap_serv_password) app.config['LDAP_PASSWORD'] = base64.b64decode(config.config_ldap_serv_password)
else:
app.config['LDAP_PASSWORD'] = base64.b64decode("")
app.config['LDAP_USERNAME'] = config.config_ldap_serv_username
else:
app.config['LDAP_USERNAME'] = ""
app.config['LDAP_PASSWORD'] = base64.b64decode("")
if bool(config.config_ldap_cert_path): if bool(config.config_ldap_cert_path):
app.config['LDAP_REQUIRE_CERT'] = True app.config['LDAP_REQUIRE_CERT'] = True
app.config['LDAP_CERT_PATH'] = config.config_ldap_cert_path app.config['LDAP_CERT_PATH'] = config.config_ldap_cert_path
...@@ -90,7 +96,7 @@ def bind_user(username, password): ...@@ -90,7 +96,7 @@ def bind_user(username, password):
log.debug("LDAP login '%s': %r", username, result) log.debug("LDAP login '%s': %r", username, result)
return result is not None, None return result is not None, None
return None, None # User not found return None, None # User not found
except (TypeError, AttributeError) as ex: except (TypeError, AttributeError, KeyError) as ex:
error = ("LDAP bind_user: %s" % ex) error = ("LDAP bind_user: %s" % ex)
return None, error return None, error
except LDAPException as ex: except LDAPException as ex:
......
...@@ -73,9 +73,9 @@ $(function () { ...@@ -73,9 +73,9 @@ $(function () {
if (showFlag === 1) { if (showFlag === 1) {
$("#meta-info").html("<ul id=\"book-list\" class=\"media-list\"></ul>"); $("#meta-info").html("<ul id=\"book-list\" class=\"media-list\"></ul>");
} }
if ((ggDone == 3 || (ggDone == 1 && ggResults.length === 0)) && if ((ggDone === 3 || (ggDone === 1 && ggResults.length === 0)) &&
(dbDone == 3 || (ggDone == 1 && dbResults.length === 0)) && (dbDone === 3 || (ggDone === 1 && dbResults.length === 0)) &&
(cvDone == 3 || (ggDone == 1 && cvResults.length === 0))) { (cvDone === 3 || (ggDone === 1 && cvResults.length === 0))) {
$("#meta-info").html("<p class=\"text-danger\">" + msg.no_result + "</p>"); $("#meta-info").html("<p class=\"text-danger\">" + msg.no_result + "</p>");
return; return;
} }
...@@ -191,7 +191,7 @@ $(function () { ...@@ -191,7 +191,7 @@ $(function () {
var dateFomers = ""; var dateFomers = "";
if (result.store_date) { if (result.store_date) {
dateFomers = result.store_date.split("-"); dateFomers = result.store_date.split("-");
}else{ } else {
dateFomers = result.date_added.split("-"); dateFomers = result.date_added.split("-");
} }
var publishedYear = parseInt(dateFomers[0]); var publishedYear = parseInt(dateFomers[0]);
...@@ -202,12 +202,12 @@ $(function () { ...@@ -202,12 +202,12 @@ $(function () {
var book = { var book = {
id: result.id, id: result.id,
title: seriesTitle + ' #' +('00' + result.issue_number).slice(-3) + ' - ' + result.name, title: seriesTitle + " #" + ("00" + result.issue_number).slice(-3) + " - " + result.name,
authors: result.author || [], authors: result.author || [],
description: result.description, description: result.description,
publisher: "", publisher: "",
publishedDate: publishedDate || "", publishedDate: publishedDate || "",
tags: ['Comics', seriesTitle], tags: ["Comics", seriesTitle],
rating: 0, rating: 0,
series: seriesTitle || "", series: seriesTitle || "",
cover: result.image.original_url, cover: result.image.original_url,
......
...@@ -211,8 +211,7 @@ $(function() { ...@@ -211,8 +211,7 @@ $(function() {
data: {"parameter":2}, data: {"parameter":2},
success: function success(data) { success: function success(data) {
$("#spinner2").hide(); $("#spinner2").hide();
ResultText = data.text; $("#DialogContent").html(data.text);
$("#DialogContent").html(ResultText);
$("#DialogFinished").removeClass("hidden"); $("#DialogFinished").removeClass("hidden");
} }
}); });
...@@ -298,7 +297,7 @@ $(function() { ...@@ -298,7 +297,7 @@ $(function() {
$(".discover .row").isotope("layout"); $(".discover .row").isotope("layout");
}); });
$('#import_ldap_users').click(function() { $("#import_ldap_users").click(function() {
$("#DialogHeader").addClass("hidden"); $("#DialogHeader").addClass("hidden");
$("#DialogFinished").addClass("hidden"); $("#DialogFinished").addClass("hidden");
$("#DialogContent").html(""); $("#DialogContent").html("");
...@@ -311,8 +310,7 @@ $(function() { ...@@ -311,8 +310,7 @@ $(function() {
url: path + "/../../import_ldap_users", url: path + "/../../import_ldap_users",
success: function success(data) { success: function success(data) {
$("#spinner2").hide(); $("#spinner2").hide();
ResultText = data.text; $("#DialogContent").html(data.text);
$("#DialogContent").html(ResultText);
$("#DialogFinished").removeClass("hidden"); $("#DialogFinished").removeClass("hidden");
} }
}); });
......
...@@ -149,12 +149,10 @@ $(function() { ...@@ -149,12 +149,10 @@ $(function() {
$.ajax({ $.ajax({
url: path + "/../../ajax/editrestriction/" + type, url: path + "/../../ajax/editrestriction/" + type,
type: "Post", type: "Post",
data: row //$(this).closest("form").serialize() + "&" + $(this)[0].name + "=", data: row
}); });
}); });
$("[id^=submit_]").click(function(event) { $("[id^=submit_]").click(function(event) {
// event.stopPropagation();
// event.preventDefault();
$(this)[0].blur(); $(this)[0].blur();
$.ajax({ $.ajax({
url: path + "/../../ajax/addrestriction/" + type, url: path + "/../../ajax/addrestriction/" + type,
......
...@@ -233,7 +233,6 @@ ...@@ -233,7 +233,6 @@
<input type="number" min="1" max="65535" class="form-control" id="config_ldap_port" name="config_ldap_port" value="{% if config.config_ldap_port != None %}{{ config.config_ldap_port }}{% endif %}" autocomplete="off" required> <input type="number" min="1" max="65535" class="form-control" id="config_ldap_port" name="config_ldap_port" value="{% if config.config_ldap_port != None %}{{ config.config_ldap_port }}{% endif %}" autocomplete="off" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="config_ldap_encryption">{{_('LDAP Encryption')}}</label>
<label for="config_ldap_encryption">{{_('LDAP Encryption')}}</label> <label for="config_ldap_encryption">{{_('LDAP Encryption')}}</label>
<select name="config_ldap_encryption" id="config_ldap_encryption" class="form-control" data-controlall="ldap-cert-settings"> <select name="config_ldap_encryption" id="config_ldap_encryption" class="form-control" data-controlall="ldap-cert-settings">
<option value="0" {% if config.config_ldap_encryption == 0 %}selected{% endif %}>{{ _('None') }}</option> <option value="0" {% if config.config_ldap_encryption == 0 %}selected{% endif %}>{{ _('None') }}</option>
...@@ -247,14 +246,25 @@ ...@@ -247,14 +246,25 @@
<input type="text" class="form-control" id="config_ldap_cert_path" name="config_ldap_cert_path" value="{% if config.config_ldap_cert_path != None %}{{ config.config_ldap_cert_path }}{% endif %}" autocomplete="off"> <input type="text" class="form-control" id="config_ldap_cert_path" name="config_ldap_cert_path" value="{% if config.config_ldap_cert_path != None %}{{ config.config_ldap_cert_path }}{% endif %}" autocomplete="off">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="config_ldap_serv_username">{{_('LDAP Administrator Username')}}</label> <label for="config_ldap_authentication">{{_('LDAP Authentication')}}</label>
<input type="text" class="form-control" id="config_ldap_serv_username" name="config_ldap_serv_username" value="{% if config.config_ldap_serv_username != None %}{{ config.config_ldap_serv_username }}{% endif %}" autocomplete="off"> <select name="config_ldap_authentication" id="config_ldap_authentication" class="form-control" data-control="ldap-auth-password" data-controlall="ldap-auth-settings">
<option value="0" {% if config.config_ldap_authentication == 0 %}selected{% endif %}>{{ _('Anonymous') }}</option>
<option value="1" {% if config.config_ldap_authentication == 1 %}selected{% endif %}>{{ _('Unauthenticated') }}</option>
<option value="2" {% if config.config_ldap_authentication == 2 %}selected{% endif %}>{{ _('Simple') }}</option>
</select>
</div> </div>
<div class="form-group"> <div data-related="ldap-auth-settings">
<label for="config_ldap_serv_password">{{_('LDAP Administrator Password')}}</label> <div class="form-group">
<input type="password" class="form-control" id="config_ldap_serv_password" name="config_ldap_serv_password" value="" autocomplete="off"> <label for="config_ldap_serv_username">{{_('LDAP Administrator Username')}}</label>
<input type="text" class="form-control" id="config_ldap_serv_username" name="config_ldap_serv_username" value="{% if config.config_ldap_serv_username != None %}{{ config.config_ldap_serv_username }}{% endif %}" autocomplete="off">
</div>
</div>
<div data-related="ldap-auth-password-2">
<div class="form-group">
<label for="config_ldap_serv_password">{{_('LDAP Administrator Password')}}</label>
<input type="password" class="form-control" id="config_ldap_serv_password" name="config_ldap_serv_password" value="" autocomplete="off">
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="config_ldap_dn">{{_('LDAP Distinguished Name (DN)')}}</label> <label for="config_ldap_dn">{{_('LDAP Distinguished Name (DN)')}}</label>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<div class="form-group"> <div class="form-group">
<input type="checkbox" name="Show_detail_random" id="Show_detail_random" {% if content.show_detail_random() %}checked{% endif %}> <input type="checkbox" name="Show_detail_random" id="Show_detail_random" {% if content.show_detail_random() %}checked{% endif %}>
<label for="Show_detail_random">{{_('Show Random Books')}}</label> <label for="Show_detail_random">{{_('Show Random Books in Detail View')}}</label>
</div> </div>
{% if ( g.user and g.user.role_admin() and not new_user ) %} {% if ( g.user and g.user.role_admin() and not new_user ) %}
<a href="#" id="get_user_tags" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add Allowed/Denied Tags')}}</a> <a href="#" id="get_user_tags" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add Allowed/Denied Tags')}}</a>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -156,6 +156,9 @@ def load_user_from_auth_header(header_val): ...@@ -156,6 +156,9 @@ def load_user_from_auth_header(header_val):
except (TypeError, UnicodeDecodeError, binascii.Error): except (TypeError, UnicodeDecodeError, binascii.Error):
pass pass
user = _fetch_user_by_name(basic_username) user = _fetch_user_by_name(basic_username)
if config.config_login_type == constants.LOGIN_LDAP and services.ldap:
if services.ldap.bind_user(str(user.password), basic_password):
return user
if user and check_password_hash(str(user.password), basic_password): if user and check_password_hash(str(user.password), basic_password):
return user return user
return return
...@@ -285,7 +288,7 @@ def import_ldap_users(): ...@@ -285,7 +288,7 @@ def import_ldap_users():
showtext = {} showtext = {}
try: try:
new_users = services.ldap.get_group_members(config.config_ldap_group_name) new_users = services.ldap.get_group_members(config.config_ldap_group_name)
except (services.ldap.LDAPException, TypeError, AttributeError) as e: except (services.ldap.LDAPException, TypeError, AttributeError, KeyError) as e:
log.debug(e) log.debug(e)
showtext['text'] = _(u'Error: %(ldaperror)s', ldaperror=e) showtext['text'] = _(u'Error: %(ldaperror)s', ldaperror=e)
return json.dumps(showtext) return json.dumps(showtext)
......
This diff is collapsed.
...@@ -17,12 +17,12 @@ goodreads>=0.3.2,<0.4.0 ...@@ -17,12 +17,12 @@ goodreads>=0.3.2,<0.4.0
python-Levenshtein>=0.12.0,<0.13.0 python-Levenshtein>=0.12.0,<0.13.0
# ldap login # ldap login
python_ldap>=3.0.0,<3.3.0 python-ldap>=3.0.0,<3.3.0
flask-simpleldap>=1.4.0,<1.5.0 Flask-SimpleLDAP>=1.4.0,<1.5.0
#oauth #oauth
flask-dance>=1.4.0,<3.1.0 Flask-Dance>=1.4.0,<3.1.0
sqlalchemy_utils>=0.33.5,<0.37.0 SQLAlchemy-Utils>=0.33.5,<0.37.0
# extracting metadata # extracting metadata
lxml>=3.8.0,<4.6.0 lxml>=3.8.0,<4.6.0
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment