mirror of
https://github.com/YunoHost-Apps/calibreweb_ynh.git
synced 2024-09-03 18:16:20 +02:00
Correct patches w/ vlogout
correct install script for tab add new todo
This commit is contained in:
parent
5f553d72cc
commit
2760dea36f
3 changed files with 53 additions and 45 deletions
|
@ -71,6 +71,7 @@ sudo yunohost app upgrade calibreweb -u https://github.com/Yunohost-Apps/calibre
|
||||||
- [X] Package_check integration
|
- [X] Package_check integration
|
||||||
- [X] On backup/remove/upgrade : check for database location to update settings
|
- [X] On backup/remove/upgrade : check for database location to update settings
|
||||||
- [ ] enable magic link
|
- [ ] enable magic link
|
||||||
|
- [ ] Add cronjob to reload database
|
||||||
|
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
|
|
|
@ -94,7 +94,7 @@ pip install --target $final_path/vendor -r $final_path/requirements.txt
|
||||||
#=================================================
|
#=================================================
|
||||||
#Cannot use empty string for X-script-name, causes an issue in the python prg
|
#Cannot use empty string for X-script-name, causes an issue in the python prg
|
||||||
if [ $path_url = "/" ] ; then
|
if [ $path_url = "/" ] ; then
|
||||||
ynh_replace_string "X-Script-Name __PATH__;" "X-Script-Name /$app;" ../conf/nginx.conf
|
ynh_replace_string "X-Script-Name __PATH__;" "X-Script-Name $app;" ../conf/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
|
|
|
@ -1,64 +1,71 @@
|
||||||
--- a/cps/web.py 2019-01-12 09:01:08.000000000 +0100
|
--- ./calibre-web-Yunohost_integration/cps/web.py 2019-01-13 16:13:23.000000000 +0100
|
||||||
+++ b/cps/web.py 2019-01-13 15:29:45.000000000 +0100
|
+++ ./ori-calibre-web-master/cps/web.py 2019-01-12 09:01:08.000000000 +0100
|
||||||
@@ -2360,10 +2360,27 @@
|
@@ -58,8 +58,6 @@
|
||||||
|
import server
|
||||||
|
from reverseproxy import ReverseProxied
|
||||||
|
|
||||||
|
-global vlogout
|
||||||
|
-
|
||||||
|
try:
|
||||||
|
from googleapiclient.errors import HttpError
|
||||||
|
except ImportError:
|
||||||
|
@@ -2362,28 +2360,10 @@
|
||||||
return redirect(url_for('basic_configuration'))
|
return redirect(url_for('basic_configuration'))
|
||||||
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('index'))
|
return redirect(url_for('index'))
|
||||||
+ auth_user = request.headers.get('X-Remote-User')
|
- auth_user = request.headers.get('X-Remote-User')
|
||||||
+ if auth_user and config.config_use_ldap:
|
- if auth_user and config.config_use_ldap and not vlogout:
|
||||||
+ user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == auth_user.strip().lower()).first()
|
- vlogout = 0
|
||||||
+ login_user(user, remember=True)
|
- user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == auth_user.strip().lower()).first()
|
||||||
+ flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
|
- login_user(user, remember=True)
|
||||||
+ return redirect(url_for("index"))
|
- flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
|
||||||
|
- return redirect(url_for("index"))
|
||||||
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.nickname) == form['username'].strip().lower()).first()
|
user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == form['username'].strip().lower()).first()
|
||||||
- if user and check_password_hash(user.password, form['password']) and user.nickname is not "Guest":
|
- if config.config_use_ldap and user:
|
||||||
+ if config.config_use_ldap and user:
|
- import ldap
|
||||||
+ import ldap
|
- try:
|
||||||
+ try:
|
- ub.User.try_login(form['username'], form['password'])
|
||||||
+ ub.User.try_login(form['username'], form['password'])
|
- login_user(user, remember=True)
|
||||||
+ login_user(user, remember=True)
|
- flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
|
||||||
+ flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
|
- return redirect_back(url_for("index"))
|
||||||
+ return redirect_back(url_for("index"))
|
- except ldap.INVALID_CREDENTIALS:
|
||||||
+ except ldap.INVALID_CREDENTIALS:
|
- ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||||
+ ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
- app.logger.info('LDAP Login failed for user "' + form['username'] + '" IP-adress: ' + ipAdress)
|
||||||
+ app.logger.info('LDAP Login failed for user "' + form['username'] + '" IP-adress: ' + ipAdress)
|
- flash(_(u"Wrong Username or Password"), category="error")
|
||||||
+ flash(_(u"Wrong Username or Password"), category="error")
|
- elif user and check_password_hash(user.password, form['password']) and user.nickname is not "Guest":
|
||||||
+ elif user and check_password_hash(user.password, form['password']) and user.nickname is not "Guest":
|
+ if user and check_password_hash(user.password, form['password']) and user.nickname is not "Guest":
|
||||||
login_user(user, remember=True)
|
login_user(user, remember=True)
|
||||||
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
|
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
|
||||||
return redirect_back(url_for("index"))
|
return redirect_back(url_for("index"))
|
||||||
@@ -2384,8 +2401,9 @@
|
@@ -2404,7 +2384,6 @@
|
||||||
@login_required
|
@login_required
|
||||||
def logout():
|
def logout():
|
||||||
if current_user is not None and current_user.is_authenticated:
|
if current_user is not None and current_user.is_authenticated:
|
||||||
+ logout_host = request.headers.get('Host')
|
- vlogout = 1
|
||||||
logout_user()
|
logout_user()
|
||||||
- return redirect(url_for('login'))
|
return redirect(url_for('login'))
|
||||||
+ return redirect("https://%servername/yunohost/sso/".replace("%servername", logout_host))
|
|
||||||
|
|
||||||
|
@@ -3109,21 +3088,6 @@
|
||||||
@app.route('/remote/login')
|
|
||||||
@@ -3088,6 +3106,21 @@
|
|
||||||
if "config_ebookconverter" in to_save:
|
if "config_ebookconverter" in to_save:
|
||||||
content.config_ebookconverter = int(to_save["config_ebookconverter"])
|
content.config_ebookconverter = int(to_save["config_ebookconverter"])
|
||||||
|
|
||||||
+ #LDAP configuratop,
|
- #LDAP configuratop,
|
||||||
+ if "config_use_ldap" in to_save and to_save["config_use_ldap"] == "on":
|
- if "config_use_ldap" in to_save and to_save["config_use_ldap"] == "on":
|
||||||
+ if not "config_ldap_provider_url" in to_save or not "config_ldap_dn" in to_save:
|
- if not "config_ldap_provider_url" in to_save or not "config_ldap_dn" in to_save:
|
||||||
+ ub.session.commit()
|
- ub.session.commit()
|
||||||
+ flash(_(u'Please enter a LDAP provider and a DN'), category="error")
|
- flash(_(u'Please enter a LDAP provider and a DN'), category="error")
|
||||||
+ return render_title_template("config_edit.html", content=config, origin=origin,
|
- return render_title_template("config_edit.html", content=config, origin=origin,
|
||||||
+ gdrive=gdriveutils.gdrive_support, gdriveError=gdriveError,
|
- gdrive=gdriveutils.gdrive_support, gdriveError=gdriveError,
|
||||||
+ goodreads=goodreads_support, title=_(u"Basic Configuration"),
|
- goodreads=goodreads_support, title=_(u"Basic Configuration"),
|
||||||
+ page="config")
|
- page="config")
|
||||||
+ else:
|
- else:
|
||||||
+ content.config_use_ldap = 1
|
- content.config_use_ldap = 1
|
||||||
+ content.config_ldap_provider_url = to_save["config_ldap_provider_url"]
|
- content.config_ldap_provider_url = to_save["config_ldap_provider_url"]
|
||||||
+ content.config_ldap_dn = to_save["config_ldap_dn"]
|
- content.config_ldap_dn = to_save["config_ldap_dn"]
|
||||||
+ db_change = True
|
- db_change = True
|
||||||
+
|
-
|
||||||
# Remote login configuration
|
# Remote login configuration
|
||||||
content.config_remote_login = ("config_remote_login" in to_save and to_save["config_remote_login"] == "on")
|
content.config_remote_login = ("config_remote_login" in to_save and to_save["config_remote_login"] == "on")
|
||||||
if not content.config_remote_login:
|
if not content.config_remote_login:
|
||||||
|
|
Loading…
Add table
Reference in a new issue