mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 19:05:39 +00:00
commit
655410ed83
@ -20,6 +20,8 @@ if 'LDAP_TYPE' in app.config.keys():
|
|||||||
LDAP_PASSWORD = app.config['LDAP_PASSWORD']
|
LDAP_PASSWORD = app.config['LDAP_PASSWORD']
|
||||||
LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE']
|
LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE']
|
||||||
LDAP_TYPE = app.config['LDAP_TYPE']
|
LDAP_TYPE = app.config['LDAP_TYPE']
|
||||||
|
LDAP_FILTER = app.config['LDAP_FILTER']
|
||||||
|
LDAP_USERNAMEFIELD = app.config['LDAP_USERNAMEFIELD']
|
||||||
else:
|
else:
|
||||||
LDAP_TYPE = False
|
LDAP_TYPE = False
|
||||||
|
|
||||||
@ -155,7 +157,8 @@ class User(db.Model):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if LDAP_TYPE == 'ldap':
|
if LDAP_TYPE == 'ldap':
|
||||||
searchFilter = "cn=%s" % self.username
|
searchFilter = "(&(%s=%s)%s)" % (LDAP_USERNAMEFIELD, self.username, LDAP_FILTER)
|
||||||
|
logging.info('Ldap searchFilter "%s"' % searchFilter)
|
||||||
else:
|
else:
|
||||||
searchFilter = "(&(objectcategory=person)(samaccountname=%s))" % self.username
|
searchFilter = "(&(objectcategory=person)(samaccountname=%s))" % self.username
|
||||||
try:
|
try:
|
||||||
@ -188,6 +191,7 @@ class User(db.Model):
|
|||||||
# this might be changed in the future
|
# this might be changed in the future
|
||||||
self.firstname = result[0][0][1]['givenName'][0]
|
self.firstname = result[0][0][1]['givenName'][0]
|
||||||
self.lastname = result[0][0][1]['sn'][0]
|
self.lastname = result[0][0][1]['sn'][0]
|
||||||
|
self.email = result[0][0][1]['mail'][0]
|
||||||
except:
|
except:
|
||||||
self.firstname = self.username
|
self.firstname = self.username
|
||||||
self.lastname = ''
|
self.lastname = ''
|
||||||
@ -214,7 +218,7 @@ class User(db.Model):
|
|||||||
We will create a local user (in DB) in order to manage user
|
We will create a local user (in DB) in order to manage user
|
||||||
profile such as name, roles,...
|
profile such as name, roles,...
|
||||||
"""
|
"""
|
||||||
user = User(username=self.username, firstname=self.firstname, lastname=self.lastname, role_id=self.role_id)
|
user = User(username=self.username, firstname=self.firstname, lastname=self.lastname, role_id=self.role_id, email=self.email)
|
||||||
db.session.add(user)
|
db.session.add(user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
# assgine user_id to current_user after create in the DB
|
# assgine user_id to current_user after create in the DB
|
||||||
@ -953,3 +957,22 @@ class Setting(db.Model):
|
|||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def toggle(self, setting):
|
||||||
|
setting = str(setting)
|
||||||
|
current_setting = Setting.query.filter(Setting.name==setting).first()
|
||||||
|
try:
|
||||||
|
if current_setting:
|
||||||
|
if current_setting.value == "True":
|
||||||
|
current_setting.value = "False"
|
||||||
|
else:
|
||||||
|
current_setting.value = "True"
|
||||||
|
db.session.commit()
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logging.error('Setting %s does not exist' % setting)
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
logging.error('Cannot toggle setting %s' % setting)
|
||||||
|
logging.debug(traceback.format_exec())
|
||||||
|
db.session.rollback()
|
||||||
|
return False
|
@ -121,7 +121,6 @@ function getdnssec(url){
|
|||||||
|
|
||||||
if (data['status'] == 'error'){
|
if (data['status'] == 'error'){
|
||||||
modal.find('.modal-body p').text(data['msg']);
|
modal.find('.modal-body p').text(data['msg']);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dnssec_msg = '';
|
dnssec_msg = '';
|
||||||
@ -144,8 +143,7 @@ function getdnssec(url){
|
|||||||
dnssec_msg += '</form>';
|
dnssec_msg += '</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
modal.find('.modal-body p').replaceWith(dnssec_msg);
|
modal.find('.modal-body p').html(dnssec_msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
});
|
});
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
<tr class="odd gradeX">
|
<tr class="odd gradeX">
|
||||||
<td><a
|
<td><a
|
||||||
href="https://google.com/search?q=site:doc.powerdns.com+{{ statistic['name'] }}"
|
href="https://google.com/search?q=site:doc.powerdns.com+{{ statistic['name'] }}"
|
||||||
target="_blank" class="btn btn-xs blue"><i
|
target="_blank" class="btn btn-flat btn-xs blue"><i
|
||||||
class="fa fa-search"></i></a></td>
|
class="fa fa-search"></i></a></td>
|
||||||
<td>{{ statistic['name'] }}</td>
|
<td>{{ statistic['name'] }}</td>
|
||||||
<td>{{ statistic['value'] }}</td>
|
<td>{{ statistic['value'] }}</td>
|
||||||
@ -73,7 +73,7 @@
|
|||||||
<tr class="odd gradeX">
|
<tr class="odd gradeX">
|
||||||
<td><a
|
<td><a
|
||||||
href="https://google.com/search?q=site:doc.powerdns.com+{{ config['name'] }}"
|
href="https://google.com/search?q=site:doc.powerdns.com+{{ config['name'] }}"
|
||||||
target="_blank" class="btn btn-xs blue"><i
|
target="_blank" class="btn btn-flat btn-xs blue"><i
|
||||||
class="fa fa-search"></i></a></td>
|
class="fa fa-search"></i></a></td>
|
||||||
<td>{{ config['name'] }}</td>
|
<td>{{ config['name'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -96,9 +96,9 @@
|
|||||||
<p>Are you sure you want to remove all history?</p>
|
<p>Are you sure you want to remove all history?</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-left"
|
<button type="button" class="btn btn-flat btn-default pull-left"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger" onclick="applyChanges('', '/admin/history');location.reload();">Clear
|
<button type="button" class="btn btn-flat btn-danger" onclick="applyChanges('', '/admin/history');location.reload();">Clear
|
||||||
History</button>
|
History</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -120,7 +120,7 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-right"
|
<button type="button" class="btn btn-flat btn-default pull-right"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -141,9 +141,9 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-left"
|
<button type="button" class="btn btn-flat btn-default pull-left"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger" id="button_revoke_confirm">Revoke</button>
|
<button type="button" class="btn btn-flat btn-danger" id="button_revoke_confirm">Revoke</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.modal-content -->
|
<!-- /.modal-content -->
|
||||||
@ -164,9 +164,9 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-left"
|
<button type="button" class="btn btn-flat btn-default pull-left"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger" id="button_delete_confirm">Delete</button>
|
<button type="button" class="btn btn-flat btn-danger" id="button_delete_confirm">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.modal-content -->
|
<!-- /.modal-content -->
|
||||||
|
137
app/templates/admin_settings.html
Normal file
137
app/templates/admin_settings.html
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
{% extends "base.html" %} {% block title %}
|
||||||
|
<title>DNS Control Panel - Settings</title>
|
||||||
|
{% endblock %} {% block dashboard_stat %}
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<section class="content-header">
|
||||||
|
<h1>
|
||||||
|
Settings <small>PowerDNS-Admin settings</small>
|
||||||
|
</h1>
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li><a href="{{ url_for('dashboard') }}"><i
|
||||||
|
class="fa fa-dashboard"></i> Home</a></li>
|
||||||
|
<li class="active">Settings</li>
|
||||||
|
</ol>
|
||||||
|
</section>
|
||||||
|
{% endblock %} {% block content %}
|
||||||
|
<section class="content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title">Settings Management</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<table id="tbl_settings" class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Value</th>
|
||||||
|
<th>Change</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for setting in settings %}
|
||||||
|
<tr class="odd ">
|
||||||
|
<td>{{ setting.name }}</td>
|
||||||
|
<td>{{ setting.value }}</td>
|
||||||
|
<td width="6%">
|
||||||
|
{% if setting.value == "True" or setting.value == "False" %}
|
||||||
|
<button type="button" class="btn btn-flat btn-warning setting-toggle-button" id="{{ setting.name }}">
|
||||||
|
Toggle <i class="fa fa-info"></i>
|
||||||
|
</button>
|
||||||
|
{% else %}
|
||||||
|
<button type="button" class="btn btn-flat btn-warning setting-edit-button" id="{{ setting.name }}">
|
||||||
|
Edit <i class="fa fa-info"></i>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!-- /.box-body -->
|
||||||
|
</div>
|
||||||
|
<!-- /.box -->
|
||||||
|
</div>
|
||||||
|
<!-- /.col -->
|
||||||
|
</div>
|
||||||
|
<!-- /.row -->
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
|
{% block extrascripts %}
|
||||||
|
<script>
|
||||||
|
// set up history data table
|
||||||
|
$("#tbl_settings").DataTable({
|
||||||
|
"paging" : true,
|
||||||
|
"lengthChange" : false,
|
||||||
|
"searching" : true,
|
||||||
|
"ordering" : true,
|
||||||
|
"info" : true,
|
||||||
|
"autoWidth" : false
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".setting-toggle-button").click(function() {
|
||||||
|
var setting = $(this).prop('id');
|
||||||
|
applyChanges('','/admin/setting/' + setting + '/toggle')
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: allow editing of value field
|
||||||
|
$(".setting-edit-button").click(function() {
|
||||||
|
var setting = $(this).prop('id');
|
||||||
|
applyChanges('','/admin/setting/' + setting + '/edit')
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
{% block modals %}
|
||||||
|
<!-- Clear History Confirmation Box -->
|
||||||
|
<div class="modal fade modal-warning" id="modal_clear_history">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
|
aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">Confirmation</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Are you sure you want to remove all history?</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-flat btn-default pull-left"
|
||||||
|
data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-flat btn-danger" onclick="applyChanges('', '/admin/history');location.reload();">Clear
|
||||||
|
History</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-dialog -->
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="modal_history_info">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
|
aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">History Details</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-flat btn-default pull-right"
|
||||||
|
data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-dialog -->
|
||||||
|
</div>
|
||||||
|
<!-- /.modal -->
|
||||||
|
{% endblock %}
|
@ -38,7 +38,7 @@
|
|||||||
<![endif]-->
|
<![endif]-->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body class="hold-transition skin-blue sidebar-mini">
|
<body class="hold-transition skin-blue sidebar-mini {% if not fullscreen_layout_setting %}layout-boxed{% endif %}">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{% block pageheader %}
|
{% block pageheader %}
|
||||||
<header class="main-header">
|
<header class="main-header">
|
||||||
@ -86,10 +86,10 @@
|
|||||||
<!-- Menu Footer-->
|
<!-- Menu Footer-->
|
||||||
<li class="user-footer">
|
<li class="user-footer">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<a href="#" class="btn btn-default btn-flat">Change password</a>
|
<a href="{{ url_for('user_profile') }}" class="btn btn-flat btn-default">My Profile</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<a href="{{ url_for('logout') }}" class="btn btn-default btn-flat">Log out</a>
|
<a href="{{ url_for('logout') }}" class="btn btn-flat btn-default">Log out</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -125,9 +125,10 @@
|
|||||||
{% if current_user.role.name == 'Administrator' %}
|
{% if current_user.role.name == 'Administrator' %}
|
||||||
<li><a href="{{ url_for('domain_add') }}"><i class="fa fa-plus"></i> <span>New Domain</span></a></li>
|
<li><a href="{{ url_for('domain_add') }}"><i class="fa fa-plus"></i> <span>New Domain</span></a></li>
|
||||||
<li class="header">ADMINISTRATION</li>
|
<li class="header">ADMINISTRATION</li>
|
||||||
<li><a href="{{ url_for('admin') }}"><i class="fa fa-circle-o"></i> <span>Admin Console</span></a></li>
|
<li><a href="{{ url_for('admin') }}"><i class="fa fa-wrench"></i> <span>Admin Console</span></a></li>
|
||||||
<li><a href="{{ url_for('admin_manageuser') }}"><i class="fa fa-circle-o"></i> <span>User</span></a></li>
|
<li><a href="{{ url_for('admin_manageuser') }}"><i class="fa fa-users"></i> <span>Users</span></a></li>
|
||||||
<li><a href="{{ url_for('admin_history') }}"><i class="fa fa-circle-o"></i> <span>History</span></a></li>
|
<li><a href="{{ url_for('admin_history') }}"><i class="fa fa-calendar"></i> <span>History</span></a></li>
|
||||||
|
<li><a href="{{ url_for('admin_settings') }}"><i class="fa fa-cog"></i> <span>Settings</span></a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
<!-- /.sidebar -->
|
<!-- /.sidebar -->
|
||||||
@ -301,7 +302,7 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-right"
|
<button type="button" class="btn btn-flat btn-default pull-right"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -324,7 +325,7 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-right"
|
<button type="button" class="btn btn-flat btn-default pull-right"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-xs-12">
|
<div class="col-lg-6">
|
||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-aqua">
|
<div class="small-box bg-aqua">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
@ -39,8 +39,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-xs-12">
|
<div class="col-lg-6">
|
||||||
<!-- small box -->
|
<a href="{{ url_for('admin_manageuser') }}">
|
||||||
<div class="small-box bg-green">
|
<div class="small-box bg-green">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>{{ users|length }}</h3>
|
<h3>{{ users|length }}</h3>
|
||||||
@ -50,11 +50,12 @@
|
|||||||
<i class="fa fa-users"></i>
|
<i class="fa fa-users"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-xs-6">
|
<div class="col-lg-6">
|
||||||
<!-- small box -->
|
<a href="{{ url_for('admin_history') }}">
|
||||||
<div class="small-box bg-green">
|
<div class="small-box bg-green">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>{{ history_number }}</h3>
|
<h3>{{ history_number }}</h3>
|
||||||
@ -64,9 +65,10 @@
|
|||||||
<i class="fa fa-calendar"></i>
|
<i class="fa fa-calendar"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-xs-6">
|
<div class="col-lg-6">
|
||||||
<!-- small box -->
|
<a href="{{ url_for('admin') }}">
|
||||||
<div class="small-box bg-green">
|
<div class="small-box bg-green">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3><span style="font-size: 18px">{{ uptime|display_second_to_time }}</span></h3>
|
<h3><span style="font-size: 18px">{{ uptime|display_second_to_time }}</span></h3>
|
||||||
@ -76,6 +78,7 @@
|
|||||||
<i class="fa fa-clock-o"></i>
|
<i class="fa fa-clock-o"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -177,7 +180,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td width="18%">
|
<td width="20%">
|
||||||
<button type="button" class="btn btn-flat btn-success" onclick="window.location.href='{{ url_for('domain', domain_name=domain.name) }}'">
|
<button type="button" class="btn btn-flat btn-success" onclick="window.location.href='{{ url_for('domain', domain_name=domain.name) }}'">
|
||||||
Manage <i class="fa fa-cog"></i>
|
Manage <i class="fa fa-cog"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -240,7 +243,7 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-right"
|
<button type="button" class="btn btn-flat btn-default pull-right"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -263,7 +266,7 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-right"
|
<button type="button" class="btn btn-flat btn-default pull-right"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,12 +24,18 @@
|
|||||||
<h3 class="box-title">Manage Records for {{ domain.name }}</h3>
|
<h3 class="box-title">Manage Records for {{ domain.name }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
{% if domain.type != 'Slave' %}
|
||||||
<button type="button" class="btn btn-flat btn-primary pull-left button_add_record" id="{{ domain.name }}">
|
<button type="button" class="btn btn-flat btn-primary pull-left button_add_record" id="{{ domain.name }}">
|
||||||
Add Record <i class="fa fa-plus"></i>
|
Add Record <i class="fa fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-flat btn-primary pull-right button_apply_changes" id="{{ domain.name }}">
|
<button type="button" class="btn btn-flat btn-primary pull-right button_apply_changes" id="{{ domain.name }}">
|
||||||
Apply Changes <i class="fa fa-floppy-o"></i>
|
Apply Changes <i class="fa fa-floppy-o"></i>
|
||||||
</button>
|
</button>
|
||||||
|
{% else %}
|
||||||
|
<button type="button" class="btn btn-flat btn-primary pull-left button_update_from_master" id="{{ domain.name }}">
|
||||||
|
Update from Master <i class="fa fa-download"></i>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<table id="tbl_records" class="table table-bordered table-striped">
|
<table id="tbl_records" class="table table-bordered table-striped">
|
||||||
@ -46,7 +52,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for record in records %}
|
{% for record in records %}
|
||||||
<tr class="odd">
|
<tr class="odd row_record" id="{{ domain.name }}">
|
||||||
<td>
|
<td>
|
||||||
{{ (record.name,domain.name)|display_record_name }}
|
{{ (record.name,domain.name)|display_record_name }}
|
||||||
</td>
|
</td>
|
||||||
@ -69,8 +75,9 @@
|
|||||||
Edit <i class="fa fa-edit"></i>
|
Edit <i class="fa fa-edit"></i>
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- TODO: replace this link for slave records -->
|
<button type="button" class="btn btn-flat btn-warning"">
|
||||||
<a href="#" class="btn default btn-xs purple"> <i class="fa fa-exclamation-circle"></i></a>
|
<i class="fa fa-exclamation-circle"></i>
|
||||||
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td width="6%">
|
<td width="6%">
|
||||||
@ -79,16 +86,20 @@
|
|||||||
Delete <i class="fa fa-trash"></i>
|
Delete <i class="fa fa-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- TODO: replace this link for slave records -->
|
<button type="button" class="btn btn-flat btn-warning"">
|
||||||
<a href="#" class="btn default btn-xs red"> <i class="fa fa-exclamation-circle"></i></a>
|
<i class="fa fa-exclamation-circle"></i>
|
||||||
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- TODO: replace these links for slave records -->
|
|
||||||
<td width="6%">
|
<td width="6%">
|
||||||
<a href="#" class="btn default btn-xs purple"> <i class="fa fa-exclamation-circle"></i></a>
|
<button type="button" class="btn btn-flat btn-warning"">
|
||||||
|
<i class="fa fa-exclamation-circle"></i>
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td width="6%">
|
<td width="6%">
|
||||||
<a href="#" class="btn default btn-xs purple"> <i class="fa fa-exclamation-circle"></i></a>
|
<button type="button" class="btn btn-flat btn-warning"">
|
||||||
|
<i class="fa fa-exclamation-circle"></i>
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
@ -131,7 +142,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// handle delete button
|
// handle delete button
|
||||||
$(document).on("click", ".button_delete", function() {
|
$(document).on("click", ".button_delete", function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
var modal = $("#modal_delete");
|
var modal = $("#modal_delete");
|
||||||
var table = $("#tbl_records").DataTable();
|
var table = $("#tbl_records").DataTable();
|
||||||
var record = $(this).prop('id');
|
var record = $(this).prop('id');
|
||||||
@ -145,11 +157,18 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
// handle edit button
|
// handle edit button
|
||||||
$(document).on("click", ".button_edit", function() {
|
$(document).on("click", ".button_edit, .row_record", function(e) {
|
||||||
var nRow = $(this).parents('tr')[0];
|
e.stopPropagation();
|
||||||
|
if ($(this).is('tr')) {
|
||||||
|
var nRow = $(this)[0];
|
||||||
|
} else {
|
||||||
|
var nRow = $(this).parents('tr')[0];
|
||||||
|
}
|
||||||
var table = $("#tbl_records").DataTable();
|
var table = $("#tbl_records").DataTable();
|
||||||
|
|
||||||
if (nEditing !== null && nEditing != nRow && nNew == false) {
|
if (nEditing == nRow) {
|
||||||
|
/* click on row already being edited, do nothing */
|
||||||
|
} else if (nEditing !== null && nEditing != nRow && nNew == false) {
|
||||||
/* Currently editing - but not this row - restore the old before continuing to edit mode */
|
/* Currently editing - but not this row - restore the old before continuing to edit mode */
|
||||||
restoreRow(table, nEditing);
|
restoreRow(table, nEditing);
|
||||||
editRow(table, nRow);
|
editRow(table, nRow);
|
||||||
@ -201,6 +220,7 @@
|
|||||||
|
|
||||||
//handle cancel button
|
//handle cancel button
|
||||||
$(document).on("click", ".button_cancel", function (e) {
|
$(document).on("click", ".button_cancel", function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
var oTable = $("#tbl_records").DataTable();
|
var oTable = $("#tbl_records").DataTable();
|
||||||
if (nNew) {
|
if (nNew) {
|
||||||
oTable.row(nEditing).remove().draw();
|
oTable.row(nEditing).remove().draw();
|
||||||
@ -214,12 +234,18 @@
|
|||||||
|
|
||||||
//handle save button
|
//handle save button
|
||||||
$(document).on("click", ".button_save", function (e) {
|
$(document).on("click", ".button_save", function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
var table = $("#tbl_records").DataTable();
|
var table = $("#tbl_records").DataTable();
|
||||||
saveRow(table, nEditing);
|
saveRow(table, nEditing);
|
||||||
nEditing = null;
|
nEditing = null;
|
||||||
nNew = false;
|
nNew = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//handle update_from_master button
|
||||||
|
$(document).on("click", ".button_update_from_master", function (e) {
|
||||||
|
var domain = $(this).prop('id');
|
||||||
|
applyChanges({'domain': domain}, '/domain/' + domain + '/update');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block modals %}
|
{% block modals %}
|
||||||
@ -237,9 +263,9 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-left"
|
<button type="button" class="btn btn-flat btn-default pull-left"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger" id="button_delete_confirm">Delete</button>
|
<button type="button" class="btn btn-flat btn-danger" id="button_delete_confirm">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.modal-content -->
|
<!-- /.modal-content -->
|
||||||
|
@ -92,8 +92,8 @@
|
|||||||
<!-- /.box-body -->
|
<!-- /.box-body -->
|
||||||
|
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<button type="submit" class="btn btn-primary">Submit</button>
|
<button type="submit" class="btn btn-flat btn-primary">Submit</button>
|
||||||
<button type="submit" class="btn btn-default" onclick="window.location.href='{{ url_for('dashboard') }}'">Cancel</button>
|
<button type="submit" class="btn btn-flat btn-default" onclick="window.location.href='{{ url_for('dashboard') }}'">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -129,26 +129,27 @@
|
|||||||
(OFF) - Not set
|
(OFF) - Not set
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCEPTION-INCREMENT -
|
INCEPTION-INCREMENT - Uses YYYYMMDDSS format for SOA serial numbers. If the SOA serial from the backend is within two days after inception, it gets incremented by two (the backend should keep SS below 98).
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCEPTION -
|
INCEPTION - Sets the SOA serial to the last inception time in YYYYMMDD01 format. Uses localtime to find the day for inception time. <strong>Not recomended.</strong>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCREMENT-WEEK -
|
INCREMENT-WEEK - Sets the SOA serial to the number of weeks since the epoch, which is the last inception time in weeks. <strong>Not recomended.</strong>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCREMENT-WEEKS -
|
INCREMENT-WEEKS - Increments the serial with the number of weeks since the UNIX epoch. This should work in every setup; but the result won't look like YYYYMMDDSS anymore.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
EPOCH -
|
EPOCH - Sets the SOA serial to the number of seconds since the epoch.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCEPTION-EPOCH -
|
INCEPTION-EPOCH - Sets the new SOA serial number to the maximum of the old SOA serial number, and age in seconds of the last inception.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
<p>Find more details at <a href="https://docs.powerdns.com/md/">https://docs.powerdns.com/md/</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="col-xs-offset-2">
|
<div class="col-xs-offset-2">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="submit" class="btn btn-primary"><i class="fa fa-check"></i> Save</button>
|
<button type="submit" class="btn btn-flat btn-primary"><i class="fa fa-check"></i> Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -107,9 +107,9 @@ $('.delete_domain').click(function() {
|
|||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-left"
|
<button type="button" class="btn btn-flat btn-default pull-left"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger" id="button_delete_confirm">
|
<button type="button" class="btn btn-flat btn-danger" id="button_delete_confirm">
|
||||||
Delete</button>
|
Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<body class="hold-transition login-page">
|
<body class="hold-transition login-page">
|
||||||
<div class="login-box">
|
<div class="login-box">
|
||||||
<div class="login-logo">
|
<div class="login-logo">
|
||||||
<a href="{{ url_for('index') }}"><b>PowerDNS</b>-Admin</a>
|
<a href="{{ url_for('index') }}">Sign In {{ login_title }}</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.login-logo -->
|
<!-- /.login-logo -->
|
||||||
<div class="login-box-body">
|
<div class="login-box-body">
|
||||||
@ -56,18 +56,26 @@
|
|||||||
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
|
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if ldap_enabled %}
|
{% if ldap_enabled and basic_enabled %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<select class="form-control" name="auth_method">
|
<select class="form-control" name="auth_method">
|
||||||
<option value="LOCAL">Local Authentication</option>
|
<option value="LOCAL">LOCAL Authentication</option>
|
||||||
<option value="LDAP">LDAP Authentication</option>
|
<option value="LDAP">LDAP Authentication</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% elif ldap_enabled and not basic_enabled %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="hidden" name="auth_method" value="LOCAL">
|
<input type="hidden" name="auth_method" value="LDAP">
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% elif basic_enabled and not ldap_enabled %}
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="hidden" name="auth_method" value="LOCAL">
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="hidden" name="auth_method" value="LOCAL">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-8">
|
<div class="col-xs-8">
|
||||||
@ -79,7 +87,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- /.col -->
|
<!-- /.col -->
|
||||||
<div class="col-xs-4">
|
<div class="col-xs-4">
|
||||||
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
|
<button type="submit" class="btn btn-flat btn-primary btn-block">Sign In</button>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.col -->
|
<!-- /.col -->
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,11 +72,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-4 pull-left">
|
<div class="col-xs-4 pull-left">
|
||||||
<button type="button" class="btn btn-block btn-flat"
|
<button type="button" class="btn btn-flat btn-block"
|
||||||
id="button_back">Back</button>
|
id="button_back">Back</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-4 pull-right">
|
<div class="col-xs-4 pull-right">
|
||||||
<button type="submit" class="btn btn-primary btn-block btn-flat">Register</button>
|
<button type="submit" class="btn btn-flat btn-primary btn-block">Register</button>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.col -->
|
<!-- /.col -->
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,177 +1,120 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block head %}
|
{% block title %}<title>DNS Control Panel - My Profile</title>{% endblock %}
|
||||||
{{ super() }}
|
|
||||||
|
|
||||||
<!-- BEGIN PAGE LEVEL STYLES -->
|
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='global/plugins/jquery-multi-select/css/multi-select.css') }}"/>
|
|
||||||
<!-- BEGIN THEME STYLES -->
|
|
||||||
|
|
||||||
<!-- BEGIN THEME STYLES -->
|
|
||||||
<!-- DOC: To use 'rounded corners' style just load 'components-rounded.css' stylesheet instead of 'components.css' in the below style tag -->
|
|
||||||
<link href="{{ url_for('static', filename='global/css/components-md.css') }}" id="style_components" rel="stylesheet" type="text/css"/>
|
|
||||||
<link href="{{ url_for('static', filename='global/css/plugins-md.css') }}" rel="stylesheet" type="text/css"/>
|
|
||||||
<link href="{{ url_for('static', filename='admin/layout2/css/layout.css') }}" rel="stylesheet" type="text/css"/>
|
|
||||||
<link href="{{ url_for('static', filename='admin/layout2/css/themes/grey.css') }}" rel="stylesheet" type="text/css" id="style_color"/>
|
|
||||||
<link href="{{ url_for('static', filename='admin/layout2/css/custom.css') }}" rel="stylesheet" type="text/css"/>
|
|
||||||
<!-- END THEME STYLES -->
|
|
||||||
{% endblock %}
|
|
||||||
{% block title %}<title>DNS Control Panel - User Profile</title>{% endblock %}
|
|
||||||
|
|
||||||
{% block dashboard_stat %}
|
{% block dashboard_stat %}
|
||||||
<!-- BEGIN PAGE HEADER-->
|
<!-- Content Header (Page header) -->
|
||||||
<h3 class="page-title">
|
<section class="content-header">
|
||||||
User Profile</h3>
|
<h1>
|
||||||
<div class="page-bar">
|
Profile
|
||||||
<ul class="page-breadcrumb">
|
<small>Edit my profile</small>
|
||||||
<li>
|
</h1>
|
||||||
<i class="fa fa-home"></i>
|
<ol class="breadcrumb">
|
||||||
<a href="{{ url_for('dashboard') }}">Home</a>
|
<li><a href="{{ url_for('dashboard') }}"><i class="fa fa-dashboard"></i>Home</a></li>
|
||||||
<i class="fa fa-angle-right"></i>
|
<li class="active">My Profile</li>
|
||||||
</li>
|
</ol>
|
||||||
<li>
|
</section>
|
||||||
<a href="#">User Profile</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<!-- END PAGE HEADER-->
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="clearfix">
|
<section class="content">
|
||||||
</div>
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
<div class="row">
|
<div class="box box-primary">
|
||||||
<div class="col-md-12">
|
<div class="box-header with-border">
|
||||||
<!-- BEGIN PROFILE CONTENT -->
|
<h3 class="box-title">Edit my profile</h3>
|
||||||
<div class="profile-content">
|
</div>
|
||||||
<div class="row">
|
<div class="box-body">
|
||||||
<div class="col-md-12">
|
<!-- Custom Tabs -->
|
||||||
<div class="portlet light">
|
<div class="nav-tabs-custom">
|
||||||
<div class="portlet-title tabbable-line">
|
<ul class="nav nav-tabs">
|
||||||
<div class="caption caption-md">
|
<li class="active"><a href="#personal_tab" data-toggle="tab">Personal
|
||||||
<i class="icon-globe theme-font hide"></i>
|
Info</a></li>
|
||||||
<span class="caption-subject font-blue-madison bold uppercase">Profile Account</span>
|
<li><a href="#avatar_tab" data-toggle="tab">Change
|
||||||
</div>
|
Avatar</a></li>
|
||||||
<ul class="nav nav-tabs">
|
<li><a href="#password_tab" data-toggle="tab">Change
|
||||||
<li class="active">
|
Password</a></li>
|
||||||
<a href="#tab_1_1" data-toggle="tab">Personal Info</a>
|
</ul>
|
||||||
</li>
|
<div class="tab-content">
|
||||||
<li>
|
<div class="tab-pane active" id="personal_tab">
|
||||||
<a href="#tab_1_2" data-toggle="tab">Change Avatar</a>
|
<form role="form" method="post" action="{{ user_profile }}">
|
||||||
</li>
|
<div class="form-group">
|
||||||
<li>
|
<label for="firstname">First Name</label> <input type="text"
|
||||||
<a href="#tab_1_3" data-toggle="tab">Change Password</a>
|
class="form-control" name="firstname" id="firstname"
|
||||||
</li>
|
placeholder="{{ current_user.firstname }}">
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
<div class="form-group">
|
||||||
<div class="portlet-body">
|
<label for="lastname">Last Name</label> <input type="text"
|
||||||
<div class="tab-content">
|
class="form-control" name="lastname" id="lastname"
|
||||||
<!-- PERSONAL INFO TAB -->
|
placeholder="{{ current_user.lastname }}">
|
||||||
<div class="tab-pane active" id="tab_1_1">
|
</div>
|
||||||
<form role="form" action="{{ user_profile }}" method="POST">
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label for="email">E-mail</label> <input type="text"
|
||||||
<label class="control-label">First Name</label>
|
class="form-control" name="email" id="email"
|
||||||
<input name="firstname" type="text" placeholder="{{ current_user.firstname }}" class="form-control"/>
|
placeholder="{{ current_user.email }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">Last Name</label>
|
<button type="submit" class="btn btn-flat btn-primary">Submit</button>
|
||||||
<input name="lastname" type="text" placeholder="{{ current_user.lastname }}" class="form-control"/>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="control-label">Email</label>
|
<div class="tab-pane" id="avatar_tab">
|
||||||
<input name="email" type="text" placeholder="{{ current_user.email }}" class="form-control"/>
|
<form action="{{ user_profile }}" method="post"
|
||||||
</div>
|
enctype="multipart/form-data">
|
||||||
<div class="margiv-top-10">
|
<div class="form-group">
|
||||||
<button type="submit" class="btn green-haze"> Save Changes</button>
|
<div class="form-group">
|
||||||
<a href="javascript:;" class="btn default">
|
<div class="thumbnail" style="width: 200px; height: 210px;">
|
||||||
Cancel </a>
|
{% if current_user.avatar %} <img
|
||||||
</div>
|
src="{{ url_for('user_avatar', filename=current_user.avatar) }}"
|
||||||
</form>
|
alt="" / style="width: 200px; height: 200px;"> {%
|
||||||
</div>
|
else %} <img
|
||||||
<!-- END PERSONAL INFO TAB -->
|
src="http://www.placehold.it/200x200/EFEFEF/AAAAAA&text=no+image"
|
||||||
<!-- CHANGE AVATAR TAB -->
|
alt="" /> {% endif %}
|
||||||
<div class="tab-pane" id="tab_1_2">
|
</div>
|
||||||
<form action="{{ user_profile }}" method="POST" enctype="multipart/form-data">
|
<div>
|
||||||
<div class="form-group">
|
<label for="file">Select image</label> <input type="file"
|
||||||
<div class="fileinput fileinput-new" data-provides="fileinput">
|
id="file" name="file">
|
||||||
<div class="fileinput-new thumbnail" style="width: 200px; height: 210px;">
|
</div>
|
||||||
{% if current_user.avatar %}
|
</div>
|
||||||
<img src="{{ url_for('user_avatar', filename=current_user.avatar) }}" alt=""/ style="width:200px;height:200px;">
|
<div>
|
||||||
{% else %}
|
<span class="label label-danger">NOTE! </span> <span> Only
|
||||||
<img src="http://www.placehold.it/200x200/EFEFEF/AAAAAA&text=no+image" alt=""/>
|
supports <strong>.PNG, .JPG, .JPEG</strong>. The best size
|
||||||
{% endif %}
|
to use is <strong>200x200</strong>.
|
||||||
</div>
|
</span>
|
||||||
<div>
|
</div>
|
||||||
<span class="btn default btn-file">
|
</div>
|
||||||
<span class="fileinput-new">
|
<div class="form-group">
|
||||||
Select image </span>
|
<button type="submit" class="btn btn-flat btn-primary">Submit</button>
|
||||||
<span class="fileinput-exists">
|
</div>
|
||||||
Change </span>
|
</form>
|
||||||
<input type="file" name="file">
|
</div>
|
||||||
</span>
|
<div class="tab-pane" id="password_tab">
|
||||||
</div>
|
{% if not current_user.password %} Your account password is
|
||||||
</div>
|
managed via LDAP which isn't supported to change here. {% else
|
||||||
<div class="clearfix margin-top-10">
|
%}
|
||||||
<span class="label label-danger">NOTE! </span>
|
<form action="{{ user_profile }}" method="post">
|
||||||
<span> Only support <strong>.PNG, .JPG, .JPEG</strong>. Best size is <strong>200x200</strong>. </span>
|
<div class="form-group">
|
||||||
</div>
|
<label for="password">New Password</label> <input
|
||||||
</div>
|
type="password" class="form-control" name="password"
|
||||||
<div class="margin-top-10">
|
id="newpassword" />
|
||||||
<button type="submit" class="btn green-haze"> Submit</button>
|
</div>
|
||||||
</div>
|
<div class="form-group">
|
||||||
</form>
|
<label for="rpassword">Re-type New Password</label> <input
|
||||||
</div>
|
type="password" class="form-control" name="rpassword"
|
||||||
<!-- END CHANGE AVATAR TAB -->
|
id="rpassword" />
|
||||||
<!-- CHANGE PASSWORD TAB -->
|
</div>
|
||||||
<div class="tab-pane" id="tab_1_3">
|
<div class="form-group">
|
||||||
{% if not current_user.password %}
|
<button type="submit" class="btn btn-flat btn-primary">Change
|
||||||
Your account password is managed via LDAP which isn't supported to change here.
|
password</button>
|
||||||
{% else %}
|
</div>
|
||||||
<form class="password-form" action="{{ user_profile }}" method="POST">
|
</form>
|
||||||
<div class="form-group">
|
{% endif %}
|
||||||
<label class="control-label">New Password</label>
|
</div>
|
||||||
<input name="password" id="newpassword" type="password" class="form-control"/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="control-label">Re-type New Password</label>
|
</div>
|
||||||
<input name="rpassword" type="password" class="form-control"/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="margin-top-10">
|
</section>
|
||||||
<button type="submit" class="btn green-haze"> Change Password</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<!-- END CHANGE PASSWORD TAB -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- END PROFILE CONTENT -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block extrascripts %}
|
||||||
{% block scripts %}
|
<!-- TODO: add password and password confirmation comparisson check -->
|
||||||
{{ super() }}
|
|
||||||
<!-- BEGIN PAGE LEVEL PLUGINS -->
|
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/bootstrap-select/bootstrap-select.min.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static', filename='global/plugins/jquery-validation/js/jquery.validate.min.js') }}" type="text/javascript"></script>
|
|
||||||
<!-- END PAGE LEVEL PLUGINS -->
|
|
||||||
|
|
||||||
<!-- BEGIN PAGE LEVEL SCRIPTS -->
|
|
||||||
<script src="{{ url_for('static', filename='global/scripts/metronic.js') }}" type="text/javascript"></script>
|
|
||||||
<script src="{{ url_for('static', filename='admin/layout2/scripts/layout.js') }}" type="text/javascript"></script>
|
|
||||||
<script src="{{ url_for('static', filename='admin/pages/scripts/user_profile.js') }}" type="text/javascript"></script>
|
|
||||||
<!-- END PAGE LEVEL SCRIPTS -->
|
|
||||||
<script>
|
|
||||||
jQuery(document).ready(function() {
|
|
||||||
Metronic.init(); // init metronic core componets
|
|
||||||
Layout.init(); // init layout
|
|
||||||
UserProfile.init();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<!-- END JAVASCRIPTS -->
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
37
app/views.py
37
app/views.py
@ -11,11 +11,17 @@ from werkzeug import secure_filename
|
|||||||
from lib import utils
|
from lib import utils
|
||||||
from app import app, login_manager
|
from app import app, login_manager
|
||||||
from .models import User, Role, Domain, DomainUser, Record, Server, History, Anonymous, Setting
|
from .models import User, Role, Domain, DomainUser, Record, Server, History, Anonymous, Setting
|
||||||
|
from distutils.util import strtobool
|
||||||
|
|
||||||
jinja2.filters.FILTERS['display_record_name'] = utils.display_record_name
|
jinja2.filters.FILTERS['display_record_name'] = utils.display_record_name
|
||||||
jinja2.filters.FILTERS['display_master_name'] = utils.display_master_name
|
jinja2.filters.FILTERS['display_master_name'] = utils.display_master_name
|
||||||
jinja2.filters.FILTERS['display_second_to_time'] = utils.display_time
|
jinja2.filters.FILTERS['display_second_to_time'] = utils.display_time
|
||||||
|
|
||||||
|
@app.context_processor
|
||||||
|
def inject_fullscreen_layout_setting():
|
||||||
|
fullscreen_layout_setting = Setting.query.filter(Setting.name == 'fullscreen_layout').first()
|
||||||
|
return dict(fullscreen_layout_setting=strtobool(fullscreen_layout_setting.value))
|
||||||
|
|
||||||
# START USER AUTHENTICATION HANDLER
|
# START USER AUTHENTICATION HANDLER
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def before_request():
|
def before_request():
|
||||||
@ -63,13 +69,17 @@ def register():
|
|||||||
@app.route('/login', methods=['GET', 'POST'])
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
@login_manager.unauthorized_handler
|
@login_manager.unauthorized_handler
|
||||||
def login():
|
def login():
|
||||||
|
# these parameters will be needed in multiple paths
|
||||||
|
LDAP_ENABLED = True if 'LDAP_TYPE' in app.config.keys() else False
|
||||||
|
LOGIN_TITLE = app.config['LOGIN_TITLE'] if 'LOGIN_TITLE' in app.config.keys() else ''
|
||||||
|
BASIC_ENABLED = app.config['BASIC_ENABLED']
|
||||||
|
SIGNUP_ENABLED = app.config['SIGNUP_ENABLED']
|
||||||
|
|
||||||
if g.user is not None and current_user.is_authenticated:
|
if g.user is not None and current_user.is_authenticated:
|
||||||
return redirect(url_for('dashboard'))
|
return redirect(url_for('dashboard'))
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
LDAP_ENABLED = True if 'LDAP_TYPE' in app.config.keys() else False
|
return render_template('login.html', ldap_enabled=LDAP_ENABLED, login_title=LOGIN_TITLE, basic_enabled=BASIC_ENABLED, signup_enabled=SIGNUP_ENABLED)
|
||||||
return render_template('login.html', ldap_enabled=LDAP_ENABLED)
|
|
||||||
|
|
||||||
# process login
|
# process login
|
||||||
username = request.form['username']
|
username = request.form['username']
|
||||||
@ -93,10 +103,10 @@ def login():
|
|||||||
try:
|
try:
|
||||||
auth = user.is_validate(method=auth_method)
|
auth = user.is_validate(method=auth_method)
|
||||||
if auth == False:
|
if auth == False:
|
||||||
return render_template('login.html', error='Invalid credentials')
|
return render_template('login.html', error='Invalid credentials', ldap_enabled=LDAP_ENABLED, login_title=LOGIN_TITLE, basic_enabled=BASIC_ENABLED, signup_enabled=SIGNUP_ENABLED)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
error = e.message['desc'] if 'desc' in e.message else e
|
error = e.message['desc'] if 'desc' in e.message else e
|
||||||
return render_template('login.html', error=error)
|
return render_template('login.html', error=error, ldap_enabled=LDAP_ENABLED, login_title=LOGIN_TITLE, basic_enabled=BASIC_ENABLED, signup_enabled=SIGNUP_ENABLED)
|
||||||
|
|
||||||
login_user(user, remember = remember_me)
|
login_user(user, remember = remember_me)
|
||||||
return redirect(request.args.get('next') or url_for('index'))
|
return redirect(request.args.get('next') or url_for('index'))
|
||||||
@ -113,7 +123,7 @@ def login():
|
|||||||
try:
|
try:
|
||||||
result = user.create_local_user()
|
result = user.create_local_user()
|
||||||
if result == True:
|
if result == True:
|
||||||
return render_template('login.html', username=username, password=password)
|
return render_template('login.html', username=username, password=password, ldap_enabled=LDAP_ENABLED, login_title=LOGIN_TITLE, basic_enabled=BASIC_ENABLED, signup_enabled=SIGNUP_ENABLED)
|
||||||
else:
|
else:
|
||||||
return render_template('register.html', error=result)
|
return render_template('register.html', error=result)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
@ -434,6 +444,23 @@ def admin_history():
|
|||||||
histories = History.query.all()
|
histories = History.query.all()
|
||||||
return render_template('admin_history.html', histories=histories)
|
return render_template('admin_history.html', histories=histories)
|
||||||
|
|
||||||
|
@app.route('/admin/settings', methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
@admin_role_required
|
||||||
|
def admin_settings():
|
||||||
|
if request.method == 'GET':
|
||||||
|
settings = Setting.query.filter(Setting.name != 'maintenance')
|
||||||
|
return render_template('admin_settings.html', settings=settings)
|
||||||
|
|
||||||
|
@app.route('/admin/setting/<string:setting>/toggle', methods=['POST'])
|
||||||
|
@login_required
|
||||||
|
@admin_role_required
|
||||||
|
def admin_settings_toggle(setting):
|
||||||
|
result = Setting().toggle(setting)
|
||||||
|
if (result):
|
||||||
|
return make_response(jsonify( { 'status': 'ok', 'msg': 'Toggled setting successfully.' } ), 200)
|
||||||
|
else:
|
||||||
|
return make_response(jsonify( { 'status': 'error', 'msg': 'Can toggle setting.' } ), 500)
|
||||||
|
|
||||||
@app.route('/user/profile', methods=['GET', 'POST'])
|
@app.route('/user/profile', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -6,6 +6,7 @@ WTF_CSRF_ENABLED = True
|
|||||||
SECRET_KEY = 'We are the world'
|
SECRET_KEY = 'We are the world'
|
||||||
BIND_ADDRESS = '127.0.0.1'
|
BIND_ADDRESS = '127.0.0.1'
|
||||||
PORT = 9393
|
PORT = 9393
|
||||||
|
LOGIN_TITLE = "PDNS"
|
||||||
|
|
||||||
# TIMEOUT - for large zones
|
# TIMEOUT - for large zones
|
||||||
TIMEOUT = 10
|
TIMEOUT = 10
|
||||||
@ -28,6 +29,13 @@ LDAP_URI = 'ldaps://your-ldap-server:636'
|
|||||||
LDAP_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me'
|
LDAP_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me'
|
||||||
LDAP_PASSWORD = 'dnsuser'
|
LDAP_PASSWORD = 'dnsuser'
|
||||||
LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
|
LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
|
||||||
|
# Additional options only if LDAP_TYPE=ldap
|
||||||
|
LDAP_USERNAMEFIELD = 'uid'
|
||||||
|
LDAP_FILTER = '(objectClass=inetorgperson)'
|
||||||
|
|
||||||
|
#Default Auth
|
||||||
|
BASIC_ENABLED = True
|
||||||
|
SIGNUP_ENABLED = True
|
||||||
|
|
||||||
# POWERDNS CONFIG
|
# POWERDNS CONFIG
|
||||||
PDNS_STATS_URL = 'http://172.16.214.131:8081/'
|
PDNS_STATS_URL = 'http://172.16.214.131:8081/'
|
||||||
|
@ -10,9 +10,11 @@ db.create_all()
|
|||||||
admin_role = Role('Administrator', 'Administrator')
|
admin_role = Role('Administrator', 'Administrator')
|
||||||
user_role = Role('User', 'User')
|
user_role = Role('User', 'User')
|
||||||
maintenance_setting = Setting('maintenance', 'False')
|
maintenance_setting = Setting('maintenance', 'False')
|
||||||
|
fullscreen_layout_setting = Setting('fullscreen_layout', 'True')
|
||||||
db.session.add(admin_role)
|
db.session.add(admin_role)
|
||||||
db.session.add(user_role)
|
db.session.add(user_role)
|
||||||
db.session.add(maintenance_setting)
|
db.session.add(maintenance_setting)
|
||||||
|
db.session.add(fullscreen_layout_setting)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
|
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
|
||||||
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
|
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
|
||||||
|
Loading…
Reference in New Issue
Block a user