add config.ini and read it with configparse
This commit is contained in:
parent
1e2f119f7f
commit
8f1aaeb417
7
luser/config.ini
Normal file
7
luser/config.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[credentials]
|
||||||
|
LDAPHOST = ldap.example.org
|
||||||
|
LDAPADMINNAME = cn=admin,dc=example,dc=org
|
||||||
|
LDAPPASS = verysecr3t
|
||||||
|
USERBASE = ou=Users,dc=example,dc=org
|
||||||
|
CAPTCHA_PATH = /var/luser/luser/static/account/register/captcha_img/
|
||||||
|
# ALTUSERBASE = ou=UsersAlt,dc=example,dc=org
|
@ -6,13 +6,19 @@ import subprocess
|
|||||||
import random
|
import random
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
|
import configparser
|
||||||
|
|
||||||
LDAPHOST = 'ldap.example.org'
|
CONFIG_PATH = "./config.ini"
|
||||||
LDAPADMINNAME = 'cn=admin,dc=example,dc=org'
|
|
||||||
LDAPPASS = 'verysecr3t'
|
config = configparser.ConfigParser()
|
||||||
USERBASE = 'ou=Users,dc=example,dc=org'
|
config.read(CONFIG_PATH)
|
||||||
ALTUSERBASE = '' # Optional
|
|
||||||
CAPTCHA_PATH = '/var/luser/luser/static/account/register/captcha_img/'
|
LDAPHOST = config.get('credentials', 'LDAPHOST')
|
||||||
|
LDAPADMINNAME = config.get('credentials', 'LDAPADMINNAME')
|
||||||
|
LDAPPASS = config.get('credentials', 'LDAPPASS')
|
||||||
|
USERBASE = config.get('credentials', 'USERBASE')
|
||||||
|
ALTUSERBASE = config.get('credentials', 'ALTUSERBASE')
|
||||||
|
CAPTCHA_PATH = config.get('credentials', 'CAPTCHA_PATH')
|
||||||
|
|
||||||
@app.route('/account/changepassword/', methods=['POST', 'GET'])
|
@app.route('/account/changepassword/', methods=['POST', 'GET'])
|
||||||
def changepassword():
|
def changepassword():
|
||||||
|
Loading…
Reference in New Issue
Block a user