@@ -91,28 +91,53 @@ randomString = function() {
9191 $ ( '#v_password' ) . text ( randomstring ) ;
9292 else
9393 $ ( '#v_password' ) . text ( Array ( randomstring . length + 1 ) . join ( '*' ) ) ;
94+ generate_mail_credentials ( ) ;
95+ }
96+
97+ generate_mail_credentials = function ( ) {
98+ var div = $ ( '.mail-infoblock' ) . clone ( ) ;
99+ div . find ( '#mail_configuration' ) . remove ( ) ;
100+ var pass = div . find ( '#v_password' ) . text ( ) ;
101+ if ( pass == "" ) div . find ( '#v_password' ) . html ( ' ' ) ;
102+ var output = div . text ( ) ;
103+ output = output . replace ( / (?: \r \n | \r | \n | \t ) / 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 ( / ^ \| + / g, "" ) ;
109+ output = output . replace ( / \| $ / , "" ) ;
110+ output = output . replace ( / $ / , "" ) ;
111+ output = output . replace ( / : \| / g, ": " ) ;
112+ output = output . replace ( / \| / g, "\n" ) ;
113+ //console.log(output);
114+ $ ( '#v_credentials' ) . val ( output ) ;
94115}
95116
96117$ ( document ) . ready ( function ( ) {
97118 $ ( '#v_account' ) . text ( $ ( 'input[name=v_account]' ) . val ( ) ) ;
98119 $ ( '#v_password' ) . text ( $ ( 'input[name=v_password]' ) . val ( ) ) ;
120+ generate_mail_credentials ( ) ;
99121
100122 $ ( 'input[name=v_account]' ) . change ( function ( ) {
101123 $ ( '#v_account' ) . text ( $ ( this ) . val ( ) ) ;
124+ generate_mail_credentials ( ) ;
102125 } ) ;
103126
104127 $ ( 'input[name=v_password]' ) . change ( function ( ) {
105128 if ( $ ( 'input[name=v_password]' ) . attr ( 'type' ) == 'text' )
106129 $ ( '#v_password' ) . text ( $ ( this ) . val ( ) ) ;
107130 else
108131 $ ( '#v_password' ) . text ( Array ( $ ( this ) . val ( ) . length + 1 ) . join ( '*' ) ) ;
132+ generate_mail_credentials ( ) ;
109133 } ) ;
110134
111135 $ ( '.toggle-psw-visibility-icon' ) . click ( function ( ) {
112136 if ( $ ( 'input[name=v_password]' ) . attr ( 'type' ) == 'text' )
113137 $ ( '#v_password' ) . text ( $ ( 'input[name=v_password]' ) . val ( ) ) ;
114138 else
115139 $ ( '#v_password' ) . text ( Array ( $ ( 'input[name=v_password]' ) . val ( ) . length + 1 ) . join ( '*' ) ) ;
140+ generate_mail_credentials ( ) ;
116141 } ) ;
117142
118143 $ ( '#mail_configuration' ) . change ( function ( evt ) {
@@ -145,5 +170,6 @@ $(document).ready(function() {
145170 $ ( '#td_smtp_encryption' ) . html ( opt . attr ( 'no_encryption' ) ) ;
146171 break ;
147172 }
173+ generate_mail_credentials ( ) ;
148174 } ) ;
149175} ) ;
0 commit comments