mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 22:44:24 +01:00
Don't render the mail server password on the config page (#428)
* Remove the currently set configuration if the checkbox is unchecked * Closes #422
This commit is contained in:
@@ -143,8 +143,15 @@ def admin_config():
|
|||||||
mail_server = utils.set_config("mail_server", request.form.get('mail_server', None))
|
mail_server = utils.set_config("mail_server", request.form.get('mail_server', None))
|
||||||
mail_port = utils.set_config("mail_port", request.form.get('mail_port', None))
|
mail_port = utils.set_config("mail_port", request.form.get('mail_port', None))
|
||||||
|
|
||||||
mail_username = utils.set_config("mail_username", request.form.get('mail_username', None))
|
if request.form.get('mail_useauth', None) and (request.form.get('mail_u', None) or request.form.get('mail_p', None)):
|
||||||
mail_password = utils.set_config("mail_password", request.form.get('mail_password', None))
|
if len(request.form.get('mail_u')) > 0:
|
||||||
|
mail_username = utils.set_config("mail_username", request.form.get('mail_u', None))
|
||||||
|
if len(request.form.get('mail_p')) > 0:
|
||||||
|
mail_password = utils.set_config("mail_password", request.form.get('mail_p', None))
|
||||||
|
|
||||||
|
elif request.form.get('mail_useauth', None) is None:
|
||||||
|
utils.set_config("mail_username", None)
|
||||||
|
utils.set_config("mail_password", None)
|
||||||
|
|
||||||
ctf_name = utils.set_config("ctf_name", request.form.get('ctf_name', None))
|
ctf_name = utils.set_config("ctf_name", request.form.get('ctf_name', None))
|
||||||
ctf_theme = utils.set_config("ctf_theme", request.form.get('ctf_theme', None))
|
ctf_theme = utils.set_config("ctf_theme", request.form.get('ctf_theme', None))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h1>Config</h1>
|
<h1>Config</h1>
|
||||||
<form method="POST">
|
<form method="POST" autocomplete="off">
|
||||||
<div class="col-md-2 col-md-offset-2">
|
<div class="col-md-2 col-md-offset-2">
|
||||||
<ul class="nav nav-pills nav-stacked">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
@@ -133,22 +133,29 @@
|
|||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input id="mail_useauth" name="mail_useauth" type="checkbox" {% if mail_useauth %}checked{% endif %}>
|
<input id="mail_useauth" name="mail_useauth" type="checkbox" {% if mail_useauth %}checked{% endif %}>
|
||||||
Specify Username and Password
|
Use Mail Server Username and Password
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="mail_username_password">
|
<div id="mail_username_password">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="start">Username:</label>
|
<label for="start">Username:</label>
|
||||||
<input class="form-control" id='mail_username' name='mail_username' type='text'
|
{% if mail_username is defined and mail_username != None %}
|
||||||
placeholder="Username"
|
<label for="mail_u"><sup>A mail server username is currently set</sup></label>
|
||||||
{% if mail_username is defined and mail_username != None %}value="{{ mail_username }}"{% endif %}>
|
{% endif %}
|
||||||
|
<input class="form-control" id='mail_u' name='mail_u' autocomplete='off' type='text'
|
||||||
|
placeholder="Username">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="start">Password:</label>
|
<label for="mail_p">Password:</label>
|
||||||
<input class="form-control" id='mail_password' name='mail_password' type='password'
|
{% if mail_password is defined and mail_password != None %}
|
||||||
placeholder="Password"
|
<label for="mail_p"><sup>An mail server password is currently set</sup></label>
|
||||||
{% if mail_password is defined and mail_password != None %}value="{{ mail_password }}"{% endif %}>
|
{% endif %}
|
||||||
|
<input class="form-control" id='mail_p' name='mail_p' autocomplete='off' type='password'
|
||||||
|
placeholder="Password">
|
||||||
</div>
|
</div>
|
||||||
|
<sup>Uncheck setting and update to remove username and password</sup>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
|
|||||||
Reference in New Issue
Block a user