Skip to content

Commit 1c12ed4

Browse files
committed
Fix shadowing of password module
1 parent b6b6604 commit 1c12ed4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,18 +350,18 @@ def edit_comment(comment_id):
350350
@app.route('/register/', methods = ['GET', 'POST'])
351351
def register():
352352
if request.method == 'POST':
353-
username, password = request.form['username'], request.form['password']
353+
username, passwd = request.form['username'], request.form['password']
354354
if len(username) < 3:
355355
flash('Username must be at least 3 characters long', 'error')
356-
elif len(password) < 8:
356+
elif len(passwd) < 8:
357357
flash('Password must be at least 8 characters long', 'error')
358358
elif not captcha.verify(
359359
config.captcha_key,
360360
request.form['captcha'],
361361
request.form['answer'],
362362
):
363363
flash('CAPTCHA answer is incorrect', 'error')
364-
elif not db.register_user(username, password.hash(password), time.time_ns()):
364+
elif not db.register_user(username, password.hash(passwd), time.time_ns()):
365365
flash('Failed to create account (username may already be taken)', 'error')
366366
else:
367367
flash('Account has been created. You can login now.', 'success')
@@ -519,10 +519,10 @@ def admin_unban_user(user_id):
519519
@app.route('/admin/user/new/', methods = ['POST'])
520520
def admin_new_user():
521521
try:
522-
name, password = request.form['name'], request.form['password']
523-
if name == '' or password == '':
522+
name, passwd = request.form['name'], request.form['password']
523+
if name == '' or passwd == '':
524524
flash('Name and password may not be empty')
525-
elif db.add_user(name, password.hash(password), time.time_ns()):
525+
elif db.add_user(name, password.hash(passwd), time.time_ns()):
526526
flash('Added user', 'success')
527527
else:
528528
flash('Failed to add user', 'error')

0 commit comments

Comments
 (0)