Author: jfthomps
Date: Fri May 12 14:12:52 2017
New Revision: 1794981
URL: http://svn.apache.org/viewvc?rev=1794981&view=rev
Log:
VCL-277 - Add support for images to join Active Directory domains
VCL-867 - Active Directory Authentication for Windows VM's
modified code to display something in the password field when editing an AD
Domain to prevent users from being confused thinking no password was set for
the entry - the form is not actually filled with the real password
addomain.php:
-modified addEditDialogHTML: set password fields to be required
-modified validateResourceData: only allow the submitted password field to be
empty if editing an existing entry
addomain.js:
-modified addNewResource: removed calls to set required to true for password
fields (always required now); added lines to set password values to empty string
-modified inlineEditResourceCB: removed calls to set required to false for
password fields (always required now); added lines to set password values to
placeholder values
-modified saveResource: if editing an AD Domain and password field values equal
the placeholder values, set the password elements in the data array to empty
strings
Modified:
vcl/trunk/web/.ht-inc/addomain.php
vcl/trunk/web/js/resources/addomain.js
Modified: vcl/trunk/web/.ht-inc/addomain.php
URL:
http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/addomain.php?rev=1794981&r1=1794980&r2=1794981&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/addomain.php (original)
+++ vcl/trunk/web/.ht-inc/addomain.php Fri May 12 14:12:52 2017
@@ -339,9 +339,9 @@ class ADdomain extends Resource {
1, '', $errmsg, '', '', '200px',
helpIcon('usernamehelp'));
# password
$errmsg = i("Password must be at least 4 characters long");
- $h .= labeledFormItem('password', i('Password'), 'password',
'^.{4,256}$', 0, '', $errmsg, '', '', '200px');
+ $h .= labeledFormItem('password', i('Password'), 'password',
'^.{4,256}$', 1, '', $errmsg, '', '', '200px');
# confirm password
- $h .= labeledFormItem('password2', i('Confirm Password'),
'password', '', 0, '', '', '', '', '200px');
+ $h .= labeledFormItem('password2', i('Confirm Password'),
'password', '', 1, '', '', '', '', '200px');
$h .= "<br>\n";
# dns server list
$ipreg =
'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
@@ -416,6 +416,7 @@ class ADdomain extends Resource {
/////////////////////////////////////////////////////////////////////////////
function validateResourceData() {
global $user;
+ $add = getContinuationVar('add', 0);
$return = array('error' => 0);
$errormsg = array();
@@ -456,9 +457,8 @@ class ADdomain extends Resource {
$errormsg[] = i("Username cannot contain single (') or
double (") quotes, less than (<), or greater than (>) and can be
from 2 to 64 characters long");
}
- if((! empty($return['password']) ||
- ! empty($return['password2'])) &&
- ! preg_match('/^.{4,256}$/', $return['password'])) {
+ if(! preg_match('/^.{4,256}$/', $return['password']) &&
+ ($add || ! (empty($return['password']) &&
empty($return['password2'])))) {
$return['error'] = 1;
$errormsg[] = i("Password must be at least 4 characters
long");
}
Modified: vcl/trunk/web/js/resources/addomain.js
URL:
http://svn.apache.org/viewvc/vcl/trunk/web/js/resources/addomain.js?rev=1794981&r1=1794980&r2=1794981&view=diff
==============================================================================
--- vcl/trunk/web/js/resources/addomain.js (original)
+++ vcl/trunk/web/js/resources/addomain.js Fri May 12 14:12:52 2017
@@ -28,8 +28,8 @@ function addNewResource(title) {
dijit.byId('addeditbtn').set('label', title);
dojo.byId('editresid').value = 0;
resetEditResource();
- dijit.byId('password').set('required', true);
- dijit.byId('password2').set('required', true);
+ dijit.byId('password').set('value', '');
+ dijit.byId('password2').set('value', '');
dijit.byId('addeditdlg').show();
}
@@ -46,8 +46,8 @@ function inlineEditResourceCB(data, ioAr
dijit.byId('username').set('value', data.items.data.username);
dijit.byId('dnsservers').set('value',
data.items.data.dnsservers);
- dijit.byId('password').set('required', false);
- dijit.byId('password2').set('required', false);
+ dijit.byId('password').set('value', '********');
+ dijit.byId('password2').set('value', 'xxxxxxxx');
dojo.byId('addeditdlgerrmsg').innerHTML = '';
dijit.byId('addeditdlg').show();
@@ -79,7 +79,13 @@ function saveResource() {
return;
data[fields[i]] = dijit.byId(fields[i]).get('value');
}
- if(dijit.byId('password').get('value') !=
dijit.byId('password2').get('value')) {
+ if(dojo.byId('editresid').value != 0 &&
+ dijit.byId('password').get('value') == '********' &&
+ dijit.byId('password2').get('value') == 'xxxxxxxx') {
+ data['password'] = '';
+ data['password2'] = '';
+ }
+ else if(dijit.byId('password').get('value') !=
dijit.byId('password2').get('value')) {
dojo.byId('addeditdlgerrmsg').innerHTML = _('Passwords do not
match');
return;
}