@@ -90,28 +90,53 @@ randomString = function() {
9090 $ ( '#v_password' ) . text ( randomstring ) ;
9191 else
9292 $ ( '#v_password' ) . text ( Array ( randomstring . length + 1 ) . join ( '*' ) ) ;
93+ generate_mail_credentials ( ) ;
94+ }
95+
96+ generate_mail_credentials = function ( ) {
97+ var div = $ ( '.mail-infoblock' ) . clone ( ) ;
98+ div . find ( '#mail_configuration' ) . remove ( ) ;
99+ var pass = div . find ( '#v_password' ) . text ( ) ;
100+ if ( pass == "" ) div . find ( '#v_password' ) . html ( ' ' ) ;
101+ var output = div . text ( ) ;
102+ output = output . replace ( / (?: \r \n | \r | \n | \t ) / g, "|" ) ;
103+ output = output . replace ( / / g, "" ) ;
104+ output = output . replace ( / \| \| / g, "|" ) ;
105+ output = output . replace ( / \| \| / g, "|" ) ;
106+ output = output . replace ( / \| \| / g, "|" ) ;
107+ output = output . replace ( / ^ \| + / g, "" ) ;
108+ output = output . replace ( / \| $ / , "" ) ;
109+ output = output . replace ( / $ / , "" ) ;
110+ output = output . replace ( / : \| / g, ": " ) ;
111+ output = output . replace ( / \| / g, "\n" ) ;
112+ //console.log(output);
113+ $ ( '#v_credentials' ) . val ( output ) ;
93114}
94115
95116$ ( document ) . ready ( function ( ) {
96117 $ ( '#v_account' ) . text ( $ ( 'input[name=v_account]' ) . val ( ) ) ;
97118 $ ( '#v_password' ) . text ( $ ( 'input[name=v_password]' ) . val ( ) ) ;
119+ generate_mail_credentials ( ) ;
98120
99121 $ ( 'input[name=v_account]' ) . change ( function ( ) {
100122 $ ( '#v_account' ) . text ( $ ( this ) . val ( ) ) ;
123+ generate_mail_credentials ( ) ;
101124 } ) ;
102125
103126 $ ( 'input[name=v_password]' ) . change ( function ( ) {
104127 if ( $ ( 'input[name=v_password]' ) . attr ( 'type' ) == 'text' )
105128 $ ( '#v_password' ) . text ( $ ( this ) . val ( ) ) ;
106129 else
107130 $ ( '#v_password' ) . text ( Array ( $ ( this ) . val ( ) . length + 1 ) . join ( '*' ) ) ;
131+ generate_mail_credentials ( ) ;
108132 } ) ;
109133
110134 $ ( '.toggle-psw-visibility-icon' ) . click ( function ( ) {
111135 if ( $ ( 'input[name=v_password]' ) . attr ( 'type' ) == 'text' )
112136 $ ( '#v_password' ) . text ( $ ( 'input[name=v_password]' ) . val ( ) ) ;
113137 else
114138 $ ( '#v_password' ) . text ( Array ( $ ( 'input[name=v_password]' ) . val ( ) . length + 1 ) . join ( '*' ) ) ;
139+ generate_mail_credentials ( ) ;
115140 } ) ;
116141
117142 $ ( '#mail_configuration' ) . change ( function ( evt ) {
@@ -144,5 +169,6 @@ $(document).ready(function() {
144169 $ ( '#td_smtp_encryption' ) . html ( opt . attr ( 'no_encryption' ) ) ;
145170 break ;
146171 }
172+ generate_mail_credentials ( ) ;
147173 } ) ;
148174} ) ;
0 commit comments