@@ -74,8 +74,8 @@ App.Actions.WEB.add_ftp_user_form = function() {
7474 var index = $ ( '.data-col2 .ftptable' ) . length + 1 ;
7575
7676 ref . find ( 'input' ) . each ( function ( i , elm ) {
77- var attr_value = $ ( elm ) . attr ( 'name' ) . replace ( '%INDEX%' , index ) ;
78- $ ( elm ) . attr ( 'name' , attr_value ) ;
77+ var attr_value = $ ( elm ) . prop ( 'name' ) . replace ( '%INDEX%' , index ) ;
78+ $ ( elm ) . prop ( 'name' , attr_value ) ;
7979 } ) ;
8080
8181 ref . find ( '.ftp-user-number' ) . text ( index ) ;
@@ -132,7 +132,34 @@ App.Actions.WEB.toggle_additional_ftp_accounts = function(elm) {
132132 }
133133}
134134
135+ App . Actions . WEB . randomPasswordGenerated = function ( elm ) {
136+ return App . Actions . WEB . passwordChanged ( elm ) ;
137+ }
138+
139+ App . Actions . WEB . passwordChanged = function ( elm ) {
140+ var ref = $ ( elm ) . parents ( '.ftptable' ) ;
141+ if ( ref . find ( '.vst-email-alert-on-psw' ) . length == 0 ) {
142+ var inp_name = ref . find ( '.v-ftp-user-is-new' ) . prop ( 'name' ) ;
143+ inp_name = inp_name . replace ( 'is_new' , 'v_ftp_email' ) ;
144+ ref . find ( 'tr:last' ) . after ( '<tr>\
145+ <td class="vst-text step-left input-label">\
146+ Send FTP credentials to email\
147+ </td>\
148+ </tr>\
149+ <tr>\
150+ <td class="step-left">\
151+ <input type="text" value="" name="' + inp_name + '" class="vst-input vst-email-alert-on-psw">\
152+ </td>\
153+ </tr>' ) ;
154+ }
155+ }
156+
135157//
136158// Page entry point
137159App . Listeners . WEB . keypress_ftp_username ( ) ;
138160App . Listeners . WEB . keypress_ftp_path ( ) ;
161+
162+ $ ( '.v-ftp-user-psw' ) . on ( 'keypress' , function ( evt ) {
163+ var elm = $ ( evt . target ) ;
164+ App . Actions . WEB . passwordChanged ( elm ) ;
165+ } ) ;
0 commit comments