Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Fix for UserAdd.base not being reset after creating a user.
Browse files Browse the repository at this point in the history
  • Loading branch information
VicentGJ committed Jan 5, 2021
1 parent 2898670 commit 426606c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugins/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FilterTreeView(FlaskForm):


def init(app):
@app.route('/tree', methods=['GET', 'POST'] )
@app.route('/tree', methods=['GET', 'POST'])
@app.route('/tree/<base>', methods=['GET', 'POST'])
@ldap_auth("Domain Users")
def tree_base(base=None):
Expand Down
13 changes: 6 additions & 7 deletions plugins/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ def init(app):
def user_add():
title = "Adicionar Usuario"

if not UserAdd.base:
UserAdd.base = request.args.get('base')

request_dict = dict(request.args)
print(request_dict)
if "base" in request_dict:
UserAdd.base = request.args.get("base")
base = UserAdd.base
print(base, "fist base")
print(base)

if g.extra_fields:
form = UserAddExtraFields(request.form)
Expand Down Expand Up @@ -167,15 +168,13 @@ def user_add():
ldap_create_entry("cn=%s,%s" % (form.user_name.data, base), attributes)
ldap_change_password(None, form.password.data, form.user_name.data)
flash(u"Usuario creado con éxito.", "success")
return redirect(url_for('user_overview',
username=form.user_name.data))
return redirect(url_for('user_overview', username=form.user_name.data))
except ldap.LDAPError as e:
e = dict(e.args[0])
flash(e['info'], "error")
elif form.errors:
print(form.errors)
flash("Some fields failed validation.", "error")

return render_template("forms/basicform.html", form=form, title=title,
action="Adicionar Usuario",
parent=url_for('tree_base'))
Expand Down

0 comments on commit 426606c

Please sign in to comment.