-
Notifications
You must be signed in to change notification settings - Fork 80
/
globalPwp.jsx
1348 lines (1289 loc) · 65.4 KB
/
globalPwp.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import cockpit from "cockpit";
import React from "react";
import { log_cmd } from "../tools.jsx";
import {
Button,
Checkbox,
Col,
ControlLabel,
Form,
FormControl,
Icon,
Nav,
NavItem,
Row,
TabContainer,
TabContent,
TabPane,
Spinner,
} from "patternfly-react";
import { Typeahead } from "react-bootstrap-typeahead";
import PropTypes from "prop-types";
const general_attrs = [
"nsslapd-pwpolicy-local",
"passwordstoragescheme",
"passwordadmindn",
"passwordtrackupdatetime",
"nsslapd-allow-hashed-passwords",
"nsslapd-pwpolicy-inherit-global",
"passwordisglobalpolicy",
"passwordchange",
"passwordmustchange",
"passwordhistory",
"passwordinhistory",
"passwordminage",
];
const exp_attrs = [
"passwordexp",
"passwordgracelimit",
"passwordsendexpiringtime",
"passwordmaxage",
"passwordwarning",
];
const lockout_attrs = [
"passwordlockout",
"passwordunlock",
"passwordlockoutduration",
"passwordmaxfailure",
"passwordresetfailurecount",
];
const syntax_attrs = [
"passwordchecksyntax",
"passwordminlength",
"passwordmindigits",
"passwordminalphas",
"passwordminuppers",
"passwordminlowers",
"passwordminspecials",
"passwordmin8bit",
"passwordmaxrepeats",
"passwordpalindrome",
"passwordmaxsequence",
"passwordmaxseqsets",
"passwordmaxclasschars",
"passwordmincategories",
"passwordmintokenlength",
"passwordbadwords",
"passworduserattributes",
"passworddictcheck",
];
export class GlobalPwPolicy extends React.Component {
constructor(props) {
super(props);
this.state = {
loading: true,
loaded: false,
activeKey: 1,
// Lists of all the attributes for each tab/section.
// We use the exact attribute name for the ID of
// each field, so we can loop over them to efficently
// check for changes, and updating/saving the config.
saveGeneralDisabled: true,
saveExpDisabled: true,
saveLockoutDisabled: true,
saveSyntaxDisabled: true,
};
this.handleNavSelect = this.handleNavSelect.bind(this);
this.handleGeneralChange = this.handleGeneralChange.bind(this);
this.saveGeneral = this.saveGeneral.bind(this);
this.handleExpChange = this.handleExpChange.bind(this);
this.saveExp = this.saveExp.bind(this);
this.handleLockoutChange = this.handleLockoutChange.bind(this);
this.saveLockout = this.saveLockout.bind(this);
this.handleSyntaxChange = this.handleSyntaxChange.bind(this);
this.saveSyntax = this.saveSyntax.bind(this);
this.loadGlobal = this.loadGlobal.bind(this);
}
componentDidMount() {
// Loading config TODO
if (!this.state.loaded) {
this.loadGlobal();
} else {
this.props.enableTree();
}
}
handleNavSelect(key) {
this.setState({ activeKey: key });
}
handleGeneralChange(e) {
let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
let attr = e.target.id;
let disableSaveBtn = true;
// Check if a setting was changed, if so enable the save button
for (let general_attr of general_attrs) {
if (attr == general_attr && this.state['_' + general_attr] != value) {
disableSaveBtn = false;
break;
}
}
// Now check for differences in values that we did not touch
for (let general_attr of general_attrs) {
if (attr != general_attr && this.state['_' + general_attr] != this.state[general_attr]) {
disableSaveBtn = false;
break;
}
}
this.setState({
[attr]: value,
saveGeneralDisabled: disableSaveBtn,
});
}
saveGeneral() {
this.setState({
loading: true
});
let cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'config', 'replace'
];
for (let attr of general_attrs) {
if (this.state['_' + attr] != this.state[attr]) {
let val = this.state[attr];
if (typeof val === "boolean") {
if (val) {
val = "on";
} else {
val = "off";
}
}
cmd.push(attr + "=" + val);
}
}
log_cmd("saveGeneral", "Saving general pwpolicy settings", cmd);
cockpit
.spawn(cmd, {superuser: true, "err": "message"})
.done(content => {
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"success",
"Successfully updated password policy configuration"
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"error",
`Error updating password policy configuration - ${errMsg.desc}`
);
});
}
handleUserChange(e) {
let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
let attr = e.target.id;
let disableSaveBtn = true;
// Check if a setting was changed, if so enable the save button
for (let user_attr of this.state.user_attrs) {
if (attr == user_attr && this.state['_' + user_attr] != value) {
disableSaveBtn = false;
break;
}
}
// Now check for differences in values that we did not touch
for (let user_attr of this.state.user_attrs) {
if (attr != user_attr && this.state['_' + user_attr] != this.state[user_attr]) {
disableSaveBtn = false;
break;
}
}
this.setState({
[attr]: value,
saveUserDisabled: disableSaveBtn,
});
}
handleExpChange(e) {
let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
let attr = e.target.id;
let disableSaveBtn = true;
// Check if a setting was changed, if so enable the save button
for (let exp_attr of exp_attrs) {
if (attr == exp_attr && this.state['_' + exp_attr] != value) {
disableSaveBtn = false;
break;
}
}
// Now check for differences in values that we did not touch
for (let exp_attr of exp_attrs) {
if (attr != exp_attr && this.state['_' + exp_attr] != this.state[exp_attr]) {
disableSaveBtn = false;
break;
}
}
this.setState({
[attr]: value,
saveExpDisabled: disableSaveBtn,
});
}
saveExp() {
this.setState({
loading: true
});
let cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'config', 'replace'
];
for (let attr of exp_attrs) {
if (this.state['_' + attr] != this.state[attr]) {
let val = this.state[attr];
if (typeof val === "boolean") {
if (val) {
val = "on";
} else {
val = "off";
}
}
cmd.push(attr + "=" + val);
}
}
log_cmd("saveExp", "Saving Expiration pwpolicy settings", cmd);
cockpit
.spawn(cmd, {superuser: true, "err": "message"})
.done(content => {
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"success",
"Successfully updated password policy configuration"
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"error",
`Error updating password policy configuration - ${errMsg.desc}`
);
});
}
handleLockoutChange(e) {
let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
let attr = e.target.id;
let disableSaveBtn = true;
// Check if a setting was changed, if so enable the save button
for (let lockout_attr of lockout_attrs) {
if (attr == lockout_attr && this.state['_' + lockout_attr] != value) {
disableSaveBtn = false;
break;
}
}
// Now check for differences in values that we did not touch
for (let lockout_attr of lockout_attrs) {
if (attr != lockout_attr && this.state['_' + lockout_attr] != this.state[lockout_attr]) {
disableSaveBtn = false;
break;
}
}
this.setState({
[attr]: value,
saveLockoutDisabled: disableSaveBtn,
});
}
saveLockout() {
this.setState({
loading: true
});
let cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'config', 'replace'
];
for (let attr of lockout_attrs) {
if (this.state['_' + attr] != this.state[attr]) {
let val = this.state[attr];
if (typeof val === "boolean") {
if (val) {
val = "on";
} else {
val = "off";
}
}
cmd.push(attr + "=" + val);
}
}
log_cmd("saveLockout", "Saving lockout pwpolicy settings", cmd);
cockpit
.spawn(cmd, {superuser: true, "err": "message"})
.done(content => {
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"success",
"Successfully updated password policy configuration"
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"error",
`Error updating password policy configuration - ${errMsg.desc}`
);
});
}
handleSyntaxChange(e) {
// Could be a typeahead change, check if "e" is an Array
let attr;
let value;
if (Array.isArray(e)) {
// Typeahead - convert array to string
attr = "passworduserattributes";
value = e.join(' ');
} else {
value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
attr = e.target.id;
}
let disableSaveBtn = true;
// Check if a setting was changed, if so enable the save button
for (let syntax_attr of syntax_attrs) {
if (syntax_attr == 'passworduserattributes' && attr == 'passworduserattributes') {
let orig_val = this.state['_' + syntax_attr].join(' ');
if (orig_val != value) {
value = e; // restore value
disableSaveBtn = false;
break;
}
value = e; // restore value
} else if (attr == syntax_attr && this.state['_' + syntax_attr] != value) {
disableSaveBtn = false;
break;
}
}
// Now check for differences in values that we did not touch
for (let syntax_attr of syntax_attrs) {
if (syntax_attr == 'passworduserattributes' && attr != 'passworduserattributes') {
// Typeahead attribute needs special care
let orig_val = this.state['_' + syntax_attr].join(' ');
let new_val = this.state[syntax_attr].join(' ');
if (orig_val != new_val) {
disableSaveBtn = false;
break;
}
} else if (attr != syntax_attr && this.state['_' + syntax_attr] != this.state[syntax_attr]) {
disableSaveBtn = false;
break;
}
}
this.setState({
[attr]: value,
saveSyntaxDisabled: disableSaveBtn,
});
}
saveSyntax() {
this.setState({
loading: true
});
let cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'config', 'replace'
];
for (let attr of syntax_attrs) {
if (this.state['_' + attr] != this.state[attr]) {
let val = this.state[attr];
if (typeof val === "boolean") {
if (val) {
val = "on";
} else {
val = "off";
}
}
cmd.push(attr + "=" + val);
}
}
log_cmd("saveSyntax", "Saving syntax checking pwpolicy settings", cmd);
cockpit
.spawn(cmd, {superuser: true, "err": "message"})
.done(content => {
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"success",
"Successfully updated password policy configuration"
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadGlobal();
this.setState({
loading: false
});
this.props.addNotification(
"error",
`Error updating password policy configuration - ${errMsg.desc}`
);
});
}
loadGlobal() {
let cmd = [
"dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
"config", "get"
];
log_cmd("loadGlobal", "Load global password policy", cmd);
cockpit
.spawn(cmd, { superuser: true, err: "message" })
.done(content => {
let config = JSON.parse(content);
let attrs = config.attrs;
// Handle the checkbox values
let pwpLocal = false;
let pwIsGlobal = false;
let pwChange = false;
let pwMustChange = false;
let pwHistory = false;
let pwTrackUpdate = false;
let pwExpire = false;
let pwSendExpire = false;
let pwLockout = false;
let pwUnlock = false;
let pwCheckSyntax = false;
let pwPalindrome = false;
let pwDictCheck = false;
let pwAllowHashed = false;
let pwInheritGlobal = false;
let pwUserAttrs = [];
if (attrs['nsslapd-pwpolicy-local'][0] == "on") {
pwpLocal = true;
}
if (attrs['passwordchange'][0] == "on") {
pwChange = true;
}
if (attrs['passwordmustchange'][0] == "on") {
pwMustChange = true;
}
if (attrs['passwordhistory'][0] == "on") {
pwHistory = true;
}
if (attrs['passwordtrackupdatetime'][0] == "on") {
pwTrackUpdate = true;
}
if (attrs['passwordisglobalpolicy'][0] == "on") {
pwIsGlobal = true;
}
if (attrs['passwordsendexpiringtime'][0] == "on") {
pwSendExpire = true;
}
if (attrs['passwordlockout'][0] == "on") {
pwLockout = true;
}
if (attrs['passwordunlock'][0] == "on") {
pwUnlock = true;
}
if (attrs['passwordexp'][0] == "on") {
pwExpire = true;
}
if (attrs['passwordchecksyntax'][0] == "on") {
pwCheckSyntax = true;
}
if (attrs['passwordpalindrome'][0] == "on") {
pwPalindrome = true;
}
if (attrs['passworddictcheck'][0] == "on") {
pwExpire = true;
}
if (attrs['nsslapd-allow-hashed-passwords'][0] == "on") {
pwAllowHashed = true;
}
if (attrs['nsslapd-pwpolicy-inherit-global'][0] == "on") {
pwInheritGlobal = true;
}
if (attrs['passwordbadwords'][0] != "") {
// Hack until this is fixed: https://github.com/389ds/389-ds-base/issues/3928
if (attrs['passwordbadwords'].length > 1) {
attrs['passwordbadwords'][0] = attrs['passwordbadwords'].join(' ');
}
}
if (attrs['passworduserattributes'][0] != "") {
if (attrs['passworduserattributes'].length > 1) {
// Hack until this is fixed: https://github.com/389ds/389-ds-base/issues/3928
attrs['passworduserattributes'][0] = attrs['passworduserattributes'].join(' ');
}
// Could be space or comma separated list
if (attrs['passworduserattributes'][0].indexOf(',') > -1) {
pwUserAttrs = attrs['passworduserattributes'][0].trim();
pwUserAttrs = pwUserAttrs.split(',');
} else {
pwUserAttrs = attrs['passworduserattributes'][0].split();
}
}
this.setState(() => (
{
loaded: true,
loading: false,
saveGeneralDisabled: true,
saveUserDisabled: true,
saveExpDisabled: true,
saveLockoutDisabled: true,
saveSyntaxDisabled: true,
// Settings
'nsslapd-pwpolicy-local': pwpLocal,
passwordisglobalpolicy: pwIsGlobal,
passwordchange: pwChange,
passwordmustchange: pwMustChange,
passwordhistory: pwHistory,
passwordtrackupdatetime: pwTrackUpdate,
passwordexp: pwExpire,
passwordsendexpiringtime: pwSendExpire,
passwordlockout: pwLockout,
passwordunlock: pwUnlock,
passwordchecksyntax: pwCheckSyntax,
passwordpalindrome: pwPalindrome,
passworddictcheck: pwDictCheck,
'nsslapd-allow-hashed-passwords': pwAllowHashed,
'nsslapd-pwpolicy-inherit-global': pwInheritGlobal,
passwordstoragescheme: attrs['passwordstoragescheme'][0],
passwordinhistory: attrs['passwordinhistory'][0],
passwordwarning: attrs['passwordwarning'][0],
passwordmaxage: attrs['passwordmaxage'][0],
passwordminage: attrs['passwordminage'][0],
passwordgracelimit: attrs['passwordgracelimit'][0],
passwordlockoutduration: attrs['passwordlockoutduration'][0],
passwordmaxfailure: attrs['passwordmaxfailure'][0],
passwordresetfailurecount: attrs['passwordresetfailurecount'][0],
passwordminlength: attrs['passwordminlength'][0],
passwordmindigits: attrs['passwordmindigits'][0],
passwordminalphas: attrs['passwordminalphas'][0],
passwordminuppers: attrs['passwordminuppers'][0],
passwordminlowers: attrs['passwordminlowers'][0],
passwordminspecials: attrs['passwordminspecials'][0],
passwordmin8bit: attrs['passwordmin8bit'][0],
passwordmaxrepeats: attrs['passwordmaxrepeats'][0],
passwordmaxsequence: attrs['passwordmaxsequence'][0],
passwordmaxseqsets: attrs['passwordmaxseqsets'][0],
passwordmaxclasschars: attrs['passwordmaxclasschars'][0],
passwordmincategories: attrs['passwordmincategories'][0],
passwordmintokenlength: attrs['passwordmintokenlength'][0],
passwordbadwords: attrs['passwordbadwords'][0],
passworduserattributes: pwUserAttrs,
passwordadmindn: attrs['passwordadmindn'][0],
// Record original values
'_nsslapd-pwpolicy-local': pwpLocal,
_passwordisglobalpolicy: pwIsGlobal,
_passwordchange: pwChange,
_passwordmustchange: pwMustChange,
_passwordhistory: pwHistory,
_passwordtrackupdatetime: pwTrackUpdate,
_passwordexp: pwExpire,
_passwordsendexpiringtime: pwSendExpire,
_passwordlockout: pwLockout,
_passwordunlock: pwUnlock,
_passwordchecksyntax: pwCheckSyntax,
_passwordpalindrome: pwPalindrome,
_passworddictcheck: pwDictCheck,
'_nsslapd-allow-hashed-passwords': pwAllowHashed,
'_nsslapd-pwpolicy-inherit-global': pwInheritGlobal,
_passwordstoragescheme: attrs['passwordstoragescheme'][0],
_passwordinhistory: attrs['passwordinhistory'][0],
_passwordwarning: attrs['passwordwarning'][0],
_passwordmaxage: attrs['passwordmaxage'][0],
_passwordminage: attrs['passwordminage'][0],
_passwordgracelimit: attrs['passwordgracelimit'][0],
_passwordlockoutduration: attrs['passwordlockoutduration'][0],
_passwordmaxfailure: attrs['passwordmaxfailure'][0],
_passwordresetfailurecount: attrs['passwordresetfailurecount'][0],
_passwordminlength: attrs['passwordminlength'][0],
_passwordmindigits: attrs['passwordmindigits'][0],
_passwordminalphas: attrs['passwordminalphas'][0],
_passwordminuppers: attrs['passwordminuppers'][0],
_passwordminlowers: attrs['passwordminlowers'][0],
_passwordminspecials: attrs['passwordminspecials'][0],
_passwordmin8bit: attrs['passwordmin8bit'][0],
_passwordmaxrepeats: attrs['passwordmaxrepeats'][0],
_passwordmaxsequence: attrs['passwordmaxsequence'][0],
_passwordmaxseqsets: attrs['passwordmaxseqsets'][0],
_passwordmaxclasschars: attrs['passwordmaxclasschars'][0],
_passwordmincategories: attrs['passwordmincategories'][0],
_passwordmintokenlength: attrs['passwordmintokenlength'][0],
_passwordbadwords: attrs['passwordbadwords'][0],
_passworduserattributes: pwUserAttrs,
_passwordadmindn: attrs['passwordadmindn'][0],
}), this.props.enableTree()
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.setState({
loaded: true,
loading: false,
});
this.props.addNotification(
"error",
`Error loading global password policy - ${errMsg.desc}`
);
});
}
render() {
let pwp_element = "";
let pwExpirationRows = "";
let pwLockoutRows = "";
let pwSyntaxRows = "";
if (this.state.passwordchecksyntax) {
pwSyntaxRows =
<div className="ds-margin-left">
<Row className="ds-margin-top" title="The minimum number of characters in the password (passwordMinLength).">
<Col componentClass={ControlLabel} sm={3}>
Min Length
</Col>
<Col sm={2}>
<FormControl
id="passwordminlength"
type="number"
min="0"
max="1000"
value={this.state.passwordminlength}
onChange={this.handleSyntaxChange}
/>
</Col>
<Col componentClass={ControlLabel} sm={3} title="Reject passwords with fewer than this many alpha characters (passwordMinAlphas).">
Min Alpha's
</Col>
<Col sm={2}>
<FormControl
id="passwordminalphas"
type="number"
min="0"
max="1000"
value={this.state.passwordminalphas}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="Reject passwords with fewer than this many digit characters (0-9) (passwordMinDigits).">
<Col componentClass={ControlLabel} sm={3}>
Min Digits
</Col>
<Col sm={2}>
<FormControl
id="passwordmindigits"
type="number"
min="0"
max="1000"
value={this.state.passwordmindigits}
onChange={this.handleSyntaxChange}
/>
</Col>
<Col componentClass={ControlLabel} sm={3}>
Min Special
</Col>
<Col sm={2} title="Reject passwords with fewer than this many special non-alphanumeric characters (passwordMinSpecials).">
<FormControl
id="passwordminspecials"
type="number"
min="0"
max="1000"
value={this.state.passwordminspecials}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row className="ds-margin-top">
<Col componentClass={ControlLabel} sm={3}>
Min Uppercase
</Col>
<Col sm={2} title="Reject passwords with fewer than this many uppercase characters (passwordMinUppers).">
<FormControl
id="passwordminuppers"
type="number"
min="0"
max="1000"
value={this.state.passwordminuppers}
onChange={this.handleSyntaxChange}
/>
</Col>
<Col componentClass={ControlLabel} sm={3}>
Min Lowercase
</Col>
<Col sm={2} title="Reject passwords with fewer than this many lowercase characters (passwordMinLowers).">
<FormControl
id="passwordminlowers"
type="number"
min="0"
max="1000"
value={this.state.passwordminlowers}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="Reject passwords with fewer than this many 8-bit or multi-byte characters (passwordMin8Bit).">
<Col componentClass={ControlLabel} sm={3}>
Min 8-bit
</Col>
<Col sm={2}>
<FormControl
id="passwordmin8bit"
type="number"
min="0"
max="1000"
value={this.state.passwordmin8bit}
onChange={this.handleSyntaxChange}
/>
</Col>
<Col componentClass={ControlLabel} sm={3}>
Min Categories
</Col>
<Col sm={2} title="The minimum number of character categories that a password must contain (categories are upper, lower, digit, special, and 8-bit) (passwordMinCategories).">
<FormControl
id="passwordmincategories"
type="number"
min="0"
max="1000"
value={this.state.passwordmincategories}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="The smallest attribute value used when checking if the password contains any of the user's account information (passwordMinTokenLength).">
<Col componentClass={ControlLabel} sm={3}>
Min Token Length
</Col>
<Col sm={2}>
<FormControl
id="passwordmintokenlength"
type="number"
min="0"
max="1000"
value={this.state.passwordmintokenlength}
onChange={this.handleSyntaxChange}
/>
</Col>
<Col componentClass={ControlLabel} sm={3}>
Max Repeated Chars
</Col>
<Col sm={2} title="The maximum number of times the same character can sequentially appear in a password (passwordMaxRepeats).">
<FormControl
id="passwordmaxrepeats"
type="number"
min="0"
max="1000"
value={this.state.passwordmaxrepeats}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="The maximum number of allowed monotonic characters sequences (passwordMaxSequence).">
<Col componentClass={ControlLabel} sm={3}>
Max Sequences
</Col>
<Col sm={2}>
<FormControl
id="passwordmaxsequence"
type="number"
min="0"
max="1000"
value={this.state.passwordmaxsequence}
onChange={this.handleSyntaxChange}
/>
</Col>
<Col componentClass={ControlLabel} sm={3}>
Max Sequence Sets
</Col>
<Col sm={2} title="The maximum number of allowed monotonic characters sequences that can appear more than once (passwordMaxSeqSets).">
<FormControl
id="passwordmaxseqsets"
type="number"
min="0"
max="1000"
value={this.state.passwordmaxseqsets}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="The maximum number of consecutive characters from the same character class/category (passwordMaxClassChars).">
<Col componentClass={ControlLabel} sm={3}>
Max Seq Per Class
</Col>
<Col sm={2}>
<FormControl
id="passwordmaxclasschars"
type="number"
min="0"
max="1000"
value={this.state.passwordmaxclasschars}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row title="A space-separated list of words that are not allowed to be contained in the new password (passwordBadWords)." className="ds-margin-top">
<Col componentClass={ControlLabel} sm={3}>
Prohibited Words
</Col>
<Col sm={8}>
<FormControl
id="passwordbadwords"
type="text"
value={this.state.passwordbadwords}
onChange={this.handleSyntaxChange}
/>
</Col>
</Row>
<Row title="A space-separated list of entry attributes to compare to the new password (passwordUserAttributes)." className="ds-margin-top">
<Col componentClass={ControlLabel} sm={3}>
Check User Attributes
</Col>
<Col sm={8}>
<Typeahead
onChange={values => {
this.handleSyntaxChange(values);
}}
multiple
selected={this.state.passworduserattributes}
options={this.props.attrs}
placeholder="Type attributes to check..."
/>
</Col>
</Row>
<Row className="ds-margin-top-lg" title="Check the password against the system's CrackLib dictionary (passwordDictCheck).">
<Col componentClass={ControlLabel} sm={3}>
<Checkbox
id="passworddictcheck"
defaultChecked={this.state.passworddictcheck}
onChange={this.handleSyntaxChange}
>
Dictionary Check
</Checkbox>
</Col>
</Row>
<Row className="ds-margin-top" title="Reject a password if it is a palindrome (passwordPalindrome).">
<Col componentClass={ControlLabel} sm={3}>
<Checkbox
id="passwordpalindrome"
defaultChecked={this.state.passwordpalindrome}
onChange={this.handleSyntaxChange}
>
Reject Palindromes
</Checkbox>
</Col>
</Row>
</div>;
}
if (this.state.passwordlockout) {
pwLockoutRows =
<div className="ds-margin-left">
<Row className="ds-margin-top" title="The maximum number of failed logins before account gets locked (passwordMaxFailure).">
<Col componentClass={ControlLabel} sm={5}>
Number of Failed Logins That Locks out Account
</Col>
<Col sm={2}>
<FormControl
id="passwordmaxfailure"
type="number"
min="1"
max="100"
value={this.state.passwordmaxfailure}
onChange={this.handleLockoutChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="The number of seconds until an accounts failure count is reset (passwordResetFailureCount).">
<Col componentClass={ControlLabel} sm={5}>
Time Until <i>Failure Count</i> Resets
</Col>
<Col sm={2}>
<FormControl
id="passwordresetfailurecount"
type="number"
min="1"
max="2147483647"
value={this.state.passwordresetfailurecount}
onChange={this.handleLockoutChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="The number of seconds, duration, before the account gets unlocked (passwordLockoutDuration).">
<Col componentClass={ControlLabel} sm={5}>
Time Until Account Unlocked
</Col>
<Col sm={2}>
<FormControl
id="passwordlockoutduration"
type="number"
min="1"
max="2147483647"
value={this.state.passwordlockoutduration}
onChange={this.handleLockoutChange}
/>
</Col>
</Row>
<Row className="ds-margin-top" title="Do not lockout the user account forever, instead the account will unlock based on the lockout duration (passwordUnlock)">
<Col componentClass={ControlLabel} sm={5}>
<Checkbox
id="passwordunlock"
defaultChecked={this.state.passwordunlock}
onChange={this.handleLockoutChange}
>
Do Not Lockout Account Forever
</Checkbox>
</Col>
</Row>
</div>;
}
if (this.state.passwordexp) {
pwExpirationRows =
<div className="ds-margin-left">
<Row className="ds-margin-top" title="The maxiumum age of a password in seconds before it expires (passwordMaxAge).">
<Col componentClass={ControlLabel} sm={5}>
Password Expiration Time
</Col>
<Col sm={2}>
<FormControl
id="passwordmaxage"
type="number"
min="1"
max="2147483647"
value={this.state.passwordmaxage}