File tree 3 files changed +26
-0
lines changed
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ CSP MySQL User Manager Changelog
993.2.0 [not yet released]
1010[+] Enable/disable groups
1111[+] Override and force database upgrade
12+ [+] Check for invalid characters in username and password
1213[#] Changed update check url for new releases
1314[#] Removed cmum dbversion from database
1415
Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ function checkusername() {
88 } else if ( password == "" ) {
99 newuser . password . focus ( ) ;
1010 }
11+ } else if ( alphanumeric ( username ) == false || alphanumeric ( password ) == false ) {
12+ if ( alphanumeric ( username ) == false ) {
13+ toastr . error ( 'Username contains invalid characters' ) ;
14+ newuser . user . focus ( ) ;
15+ } else if ( alphanumeric ( password ) == false ) {
16+ toastr . error ( 'Password contains invalid characters' ) ;
17+ newuser . password . focus ( ) ;
18+ }
1119 } else {
1220 jQuery . ajax ( {
1321 type : 'post' ,
@@ -38,6 +46,14 @@ function checkeditusername() {
3846 if ( username == "" ) {
3947 edituser . user . focus ( ) ;
4048 }
49+ } else if ( alphanumeric ( username ) == false || alphanumeric ( password ) == false ) {
50+ if ( alphanumeric ( username ) == false ) {
51+ toastr . error ( 'Username contains invalid characters' ) ;
52+ newuser . user . focus ( ) ;
53+ } else if ( alphanumeric ( password ) == false ) {
54+ toastr . error ( 'Password contains invalid characters' ) ;
55+ newuser . password . focus ( ) ;
56+ }
4157 } else {
4258 if ( username != rusername ) {
4359 jQuery . ajax ( {
Original file line number Diff line number Diff line change @@ -54,4 +54,13 @@ function checksearch(e) {
5454 $ ( '#newsearch' ) . trigger ( 'submit' , true ) ;
5555 }
5656 }
57+ }
58+
59+ function alphanumeric ( inputtxt ) {
60+ var letters = / ^ [ 0 - 9 a - z A - Z ] + $ / ;
61+ if ( letters . test ( inputtxt ) ) {
62+ return true ;
63+ } else {
64+ return false ;
65+ }
5766}
You can’t perform that action at this time.
0 commit comments