mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 14:21:13 +00:00
adding ability to provide username and password when creating new task
This commit is contained in:
@@ -41,7 +41,9 @@ function route (app) {
|
||||
url: req.body.url,
|
||||
standard: req.body.standard,
|
||||
ignore: req.body.ignore || [],
|
||||
timeout: req.body.timeout
|
||||
timeout: req.body.timeout,
|
||||
username: req.body.username,
|
||||
password: req.body.password
|
||||
};
|
||||
app.webservice.tasks.create(newTask, function (err, task) {
|
||||
if (err) {
|
||||
|
@@ -61,6 +61,8 @@ function route (app) {
|
||||
task.name = req.body.name;
|
||||
task.ignore = req.body.ignore;
|
||||
task.timeout = req.body.timeout;
|
||||
task.username = req.body.username;
|
||||
task.password = req.body.password;
|
||||
var standards = getStandards().map(function (standard) {
|
||||
if (standard.title === task.standard) {
|
||||
standard.selected = true;
|
||||
|
@@ -64,6 +64,20 @@ describe('GET /new', function () {
|
||||
assert.strictEqual(field.getAttribute('value'), '');
|
||||
});
|
||||
|
||||
it('should have a "username" field', function () {
|
||||
var field = this.form.querySelectorAll('input[name=username]')[0];
|
||||
assert.isDefined(field);
|
||||
assert.strictEqual(field.getAttribute('type'), 'text');
|
||||
assert.strictEqual(field.getAttribute('value'), '');
|
||||
});
|
||||
|
||||
it('should have a "password" field', function () {
|
||||
var field = this.form.querySelectorAll('input[name=password]')[0];
|
||||
assert.isDefined(field);
|
||||
assert.strictEqual(field.getAttribute('type'), 'text');
|
||||
assert.strictEqual(field.getAttribute('value'), '');
|
||||
});
|
||||
|
||||
it('should have a "standard" field', function () {
|
||||
var field = this.form.querySelectorAll('select[name=standard]')[0];
|
||||
assert.isDefined(field);
|
||||
|
@@ -71,6 +71,20 @@ describe('GET /<task-id>/edit', function () {
|
||||
assert.isDefined(field.getAttribute('disabled'));
|
||||
});
|
||||
|
||||
it('should have a "username" field', function () {
|
||||
var field = this.form.querySelectorAll('input[name=username]')[0];
|
||||
assert.isDefined(field);
|
||||
assert.strictEqual(field.getAttribute('type'), 'text');
|
||||
assert.strictEqual(field.getAttribute('value'), 'user');
|
||||
});
|
||||
|
||||
it('should have a "password" field', function () {
|
||||
var field = this.form.querySelectorAll('input[name=password]')[0];
|
||||
assert.isDefined(field);
|
||||
assert.strictEqual(field.getAttribute('type'), 'text');
|
||||
assert.strictEqual(field.getAttribute('value'), 'access');
|
||||
});
|
||||
|
||||
it('should have "ignore" fields', function () {
|
||||
var fields = this.form.querySelectorAll('input[name="ignore[]"]');
|
||||
assert.isDefined(fields);
|
||||
@@ -89,6 +103,8 @@ describe('POST /<task-id>/edit', function () {
|
||||
endpoint: '/abc000000000000000000001/edit',
|
||||
body: {
|
||||
name: 'foo',
|
||||
username: 'newuser',
|
||||
password: 'secure',
|
||||
ignore: ['bar', 'baz']
|
||||
}
|
||||
};
|
||||
@@ -102,6 +118,8 @@ describe('POST /<task-id>/edit', function () {
|
||||
it('should edit the task', function (done) {
|
||||
this.webservice.task('abc000000000000000000001').get({}, function (err, task) {
|
||||
assert.strictEqual(task.name, 'foo');
|
||||
assert.strictEqual(task.username, 'newuser');
|
||||
assert.strictEqual(task.password, 'secure');
|
||||
assert.deepEqual(task.ignore, ['bar', 'baz']);
|
||||
done();
|
||||
});
|
||||
|
@@ -74,6 +74,24 @@ along with pa11y-dashboard. If not, see <http://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group clearfix">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<label class="control-label" for="new-task-username">Username</label>
|
||||
<input class="form-control" id="new-task-username" type="text" name="username" value="{{task.username}}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group clearfix">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<label class="control-label" for="new-task-password">Password</label>
|
||||
<input class="form-control" id="new-task-password" type="text" name="password" value="{{task.password}}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/nature/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
|
||||
|
||||
<div class="standards-lists">
|
||||
|
@@ -86,6 +86,24 @@ along with pa11y-dashboard. If not, see <http://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group clearfix">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<label class="control-label" for="new-task-username">Username</label>
|
||||
<input class="form-control" id="new-task-username" type="text" name="username" value="{{task.username}}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group clearfix">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<label class="control-label" for="new-task-password">Password</label>
|
||||
<input class="form-control" id="new-task-password" type="text" name="password" value="{{task.password}}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/nature/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
|
||||
|
||||
<div class="standards-lists">
|
||||
|
Reference in New Issue
Block a user