Plugin Directory

Changeset 3175818


Ignore:
Timestamp:
10/25/2024 06:27:28 PM (17 months ago)
Author:
Beherit
Message:

Minor changes in two-step registration

Location:
ejabberd-account-tools/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ejabberd-account-tools/trunk/ejabberd-account-tools.pot

    r2681972 r3175818  
    33msgstr ""
    44"Project-Id-Version: Ejabberd Account Tools\n"
    5 "POT-Creation-Date: 2022-02-20 12:23+0100\n"
     5"POT-Creation-Date: 2024-10-25 20:16+0200\n"
    66"PO-Revision-Date: \n"
    77"Last-Translator: \n"
     
    1212"Content-Transfer-Encoding: 8bit\n"
    1313"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    14 "X-Generator: Poedit 3.0.1\n"
     14"X-Generator: Poedit 3.5\n"
    1515"X-Poedit-Basepath: .\n"
    1616"X-Poedit-SourceCharset: UTF-8\n"
     
    189189#, php-format
    190190msgid ""
    191 "Form to change private email address is temporarily disabled, click <a href="
    192 "\"%s\">here</a> to turn it on again."
     191"Form to change private email address is temporarily disabled, click <a "
     192"href=\"%s\">here</a> to turn it on again."
    193193msgstr ""
    194194
     
    210210#, php-format
    211211msgid ""
    212 "Web Presence configuration form is temporarily disabled, click <a href=\"%s"
    213 "\">here</a> to turn it on again."
     212"Web Presence configuration form is temporarily disabled, click <a "
     213"href=\"%s\">here</a> to turn it on again."
    214214msgstr ""
    215215
     
    238238msgstr ""
    239239
    240 #: includes/admin-settings.php:215 includes/register.php:170
     240#: includes/admin-settings.php:215 includes/register.php:180
    241241msgid "Username"
    242242msgstr ""
     
    248248#: includes/admin-settings.php:221 includes/admin-settings.php:286
    249249#: includes/change_email.php:112 includes/delete_account.php:77
    250 #: includes/delete_account.php:105 includes/register.php:175
     250#: includes/delete_account.php:105 includes/register.php:185
    251251#: includes/reset_password.php:89 includes/webpresence.php:141
    252252msgid "Password"
     
    558558msgstr ""
    559559
    560 #: includes/admin-settings.php:535
     560#: includes/admin-settings.php:538
    561561msgid ""
    562562"Then configure ReST API url and authorization data, finally put shortcodes "
     
    564564msgstr ""
    565565
    566 #: includes/admin-settings.php:537
     566#: includes/admin-settings.php:540
    567567msgid "Form to register a new account."
    568568msgstr ""
    569569
    570 #: includes/admin-settings.php:538
     570#: includes/admin-settings.php:541
    571571msgid "Form to change / add private email address."
    572572msgstr ""
    573573
    574 #: includes/admin-settings.php:539
     574#: includes/admin-settings.php:542
    575575msgid "Form to reset account password."
    576576msgstr ""
    577577
    578 #: includes/admin-settings.php:540
     578#: includes/admin-settings.php:543
    579579msgid "Form to delete account."
    580580msgstr ""
    581581
    582 #: includes/admin-settings.php:541
     582#: includes/admin-settings.php:544
    583583msgid "Web Presence configuration form."
    584584msgstr ""
    585585
    586 #: includes/admin-settings.php:560
     586#: includes/admin-settings.php:563
    587587msgid "The cache has been successfully cleared."
    588588msgstr ""
    589589
    590 #: includes/admin-settings.php:562 includes/admin-tools.php:269
     590#: includes/admin-settings.php:565 includes/admin-tools.php:269
    591591#: includes/admin-tools.php:326 includes/admin-tools.php:381
    592592#: includes/admin-tools.php:416 includes/admin-tools.php:472
     
    596596#: includes/delete_account.php:254 includes/delete_account.php:255
    597597#: includes/delete_account.php:348 includes/delete_account.php:349
    598 #: includes/functions.php:201 includes/functions.php:202
    599 #: includes/functions.php:293 includes/functions.php:294
    600 #: includes/functions.php:329 includes/functions.php:330
    601 #: includes/register.php:43 includes/register.php:44 includes/register.php:384
    602 #: includes/register.php:385 includes/reset_password.php:33
     598#: includes/functions.php:197 includes/functions.php:198
     599#: includes/functions.php:289 includes/functions.php:290
     600#: includes/functions.php:325 includes/functions.php:326
     601#: includes/register.php:43 includes/register.php:44 includes/register.php:390
     602#: includes/register.php:391 includes/reset_password.php:33
    603603#: includes/reset_password.php:34 includes/reset_password.php:272
    604 #: includes/reset_password.php:273 includes/reset_password.php:356
    605 #: includes/reset_password.php:357 includes/webpresence.php:24
     604#: includes/reset_password.php:273 includes/reset_password.php:360
     605#: includes/reset_password.php:361 includes/webpresence.php:24
    606606#: includes/webpresence.php:25 includes/webpresence.php:274
    607607#: includes/webpresence.php:275
     
    678678#: includes/change_email.php:220 includes/change_email.php:235
    679679#: includes/delete_account.php:191 includes/delete_account.php:206
    680 #: includes/delete_account.php:304 includes/functions.php:270
    681 #: includes/register.php:298 includes/webpresence.php:235
     680#: includes/delete_account.php:304 includes/functions.php:266
     681#: includes/register.php:302 includes/webpresence.php:235
    682682#: includes/webpresence.php:244
    683683msgid "Server is temporarily unavailable, please try again in a moment."
     
    690690
    691691#: includes/admin-tools.php:208 includes/change_email.php:187
    692 #: includes/register.php:275
     692#: includes/register.php:285
    693693msgid "Email address seems invalid, change it and try again."
    694694msgstr ""
    695695
    696696#: includes/admin-tools.php:212 includes/change_email.php:192
    697 #: includes/register.php:280
     697#: includes/register.php:290
    698698msgid ""
    699699"Disposable emails addresses are forbidden, please change entered email "
     
    831831
    832832#: includes/change_email.php:173 includes/delete_account.php:156
    833 #: includes/delete_account.php:294 includes/register.php:243
     833#: includes/delete_account.php:294 includes/register.php:253
    834834#: includes/reset_password.php:156 includes/reset_password.php:312
    835835#: includes/webpresence.php:225
     
    838838
    839839#: includes/change_email.php:180 includes/delete_account.php:163
    840 #: includes/functions.php:242 includes/register.php:256
     840#: includes/functions.php:238 includes/register.php:266
    841841#: includes/reset_password.php:163
    842842msgid "Captcha validation error, try again."
     
    846846#: includes/change_email.php:226 includes/delete_account.php:170
    847847#: includes/delete_account.php:183 includes/delete_account.php:197
    848 #: includes/functions.php:249 includes/functions.php:262
     848#: includes/functions.php:245 includes/functions.php:258
    849849msgid "Invalid username or password, correct them and try again."
    850850msgstr ""
     
    936936msgstr ""
    937937
    938 #: includes/delete_account.php:319 includes/functions.php:181
     938#: includes/delete_account.php:319 includes/functions.php:177
    939939#: includes/reset_password.php:191 includes/reset_password.php:206
    940 #: includes/reset_password.php:322
     940#: includes/reset_password.php:328
    941941msgid "Server is temporarily unavailable."
    942942msgstr ""
     
    950950msgstr ""
    951951
    952 #: includes/functions.php:165 includes/register.php:28
     952#: includes/functions.php:161 includes/register.php:28
    953953msgid "Username doesn't meet the requirements."
    954954msgstr ""
    955955
    956 #: includes/functions.php:169
     956#: includes/functions.php:165
    957957msgid "Username contains forbidden words."
    958958msgstr ""
    959959
    960 #: includes/functions.php:186
     960#: includes/functions.php:182
    961961msgid "Selected username is available."
    962962msgstr ""
    963963
    964 #: includes/functions.php:191
     964#: includes/functions.php:187
    965965msgid "Selected username is already registered."
    966966msgstr ""
    967967
    968 #: includes/functions.php:197 includes/register.php:376
     968#: includes/functions.php:193 includes/register.php:382
    969969msgid "Invalid host name, try again."
    970970msgstr ""
    971971
    972 #: includes/functions.php:276
     972#: includes/functions.php:272
    973973msgid "Invalid login or password, correct them and try again."
    974974msgstr ""
    975975
    976 #: includes/functions.php:286
     976#: includes/functions.php:282
    977977msgid "Signed in to the account, redirecting..."
    978978msgstr ""
     
    10181018msgstr ""
    10191019
    1020 #: includes/register.php:97 includes/register.php:249
     1020#: includes/register.php:97 includes/register.php:259
    10211021msgid "You can't register another account so quickly. Please try again later."
    10221022msgstr ""
    10231023
    1024 #: includes/register.php:107
     1024#: includes/register.php:109
    10251025msgid ""
    10261026"Account activation failed because server is temporarily unavailable. Please "
     
    10281028msgstr ""
    10291029
    1030 #: includes/register.php:140
     1030#: includes/register.php:142
    10311031#, php-format
    10321032msgid "Account %s has been successfully activated."
    10331033msgstr ""
    10341034
    1035 #: includes/register.php:144
     1035#: includes/register.php:146
    10361036msgid ""
    10371037"Unexpected error occurred while attempting to activate account. Please try "
     
    10391039msgstr ""
    10401040
    1041 #: includes/register.php:152
     1041#: includes/register.php:154
     1042#, php-format
     1043msgid "Account %s has already been activated."
     1044msgstr ""
     1045
     1046#: includes/register.php:162
    10421047msgid ""
    10431048"The link to activate account has expired or is not valid. Please fill the "
     
    10451050msgstr ""
    10461051
    1047 #: includes/register.php:179
     1052#: includes/register.php:189
    10481053msgid "Private email"
    10491054msgstr ""
    10501055
    1051 #: includes/register.php:184
     1056#: includes/register.php:194
    10521057msgid "Create account"
    10531058msgstr ""
    10541059
    1055 #: includes/register.php:263
     1060#: includes/register.php:273
    10561061msgid ""
    10571062"The selected username doesn't meet the requirements, change it and try again."
    10581063msgstr ""
    10591064
    1060 #: includes/register.php:268
     1065#: includes/register.php:278
    10611066msgid ""
    10621067"The selected username contains forbidden words, change it and try again."
    10631068msgstr ""
    10641069
    1065 #: includes/register.php:313
     1070#: includes/register.php:319
    10661071#, php-format
    10671072msgid "Confirm your new account on %s"
    10681073msgstr ""
    10691074
    1070 #: includes/register.php:314
     1075#: includes/register.php:320
    10711076#, php-format
    10721077msgid ""
    10731078"Hey %s!<br><br>You have registered the account %s with this email address. "
    1074 "To complete your registration, please click on the activation link:<br><br>"
    1075 "%s<br><br>If you haven't registered an account, simply disregard this email."
    1076 "<br><br>Greetings,<br>%s"
    1077 msgstr ""
    1078 
    1079 #: includes/register.php:320
     1079"To complete your registration, please click on the activation link:"
     1080"<br><br>%s<br><br>If you haven't registered an account, simply disregard "
     1081"this email.<br><br>Greetings,<br>%s"
     1082msgstr ""
     1083
     1084#: includes/register.php:326
    10801085msgid ""
    10811086"An email has been sent to you to complete registration. It contains an "
     
    10831088msgstr ""
    10841089
    1085 #: includes/register.php:325
     1090#: includes/register.php:331
    10861091msgid "Failed to complete registration, please contact with the administrator."
    10871092msgstr ""
    10881093
    1089 #: includes/register.php:332
     1094#: includes/register.php:338
    10901095#, php-format
    10911096msgid "Account %s has been successfully registered."
    10921097msgstr ""
    10931098
    1094 #: includes/register.php:369
     1099#: includes/register.php:375
    10951100msgid "The selected username is already registered, change it and try again."
    10961101msgstr ""
     
    11281133msgid ""
    11291134"Hey %s!<br><br>Someone requested to change the password for your XMPP "
    1130 "account %s. To complete the change, please click the following link:<br><br>"
    1131 "%s<br><br>If you haven't made this change, simply disregard this email."
    1132 "<br><br>Greetings,<br>%s"
     1135"account %s. To complete the change, please click the following link:"
     1136"<br><br>%s<br><br>If you haven't made this change, simply disregard this "
     1137"email.<br><br>Greetings,<br>%s"
    11331138msgstr ""
    11341139
     
    11501155msgstr ""
    11511156
    1152 #: includes/reset_password.php:343
     1157#: includes/reset_password.php:347
    11531158msgid "The password for your account was successfully changed."
    11541159msgstr ""
    11551160
    1156 #: includes/reset_password.php:352
     1161#: includes/reset_password.php:356
    11571162msgid "The link to reset password has expired or is not valid."
    11581163msgstr ""
  • ejabberd-account-tools/trunk/includes/register.php

    r3175084 r3175818  
    101101            // Code valid
    102102            if(true == ($transient = get_transient('ejabat_register_'.$request['code']))) {
    103                 // Try set correct password
    104                 $response = ejabat_get_xmpp_data('unban_account', array('user' => $transient['username'], 'host' => $transient['host']));
    105                 // Server unavailable
    106                 if(is_null($response)) {
    107                     $html = '<p class="ejabat"><span class="ejabat-info ejabat-error">'.__('Account activation failed because server is temporarily unavailable. Please try again in a moment.', 'ejabberd-account-tools').'</span></p>';
    108                 }
    109                 // Password changed
    110                 else if($response['code'] == 0) {
    111                     // Send welcome message
    112                     if(get_option('ejabat_welcome_msg', false)) {
    113                         // Get subject and body
    114                         $welcome_msg = apply_filters('ejabat_welcome_msg_args', array(
    115                             'subject' => get_option('ejabat_welcome_msg_subject'),
    116                             'body' => get_option('ejabat_welcome_msg_body')
    117                         ));
    118                         $welcome_msg['subject'] = htmlspecialchars(wp_strip_all_tags(do_shortcode($welcome_msg['subject'])));
    119                         $welcome_msg['subject'] = str_replace(array('\r\n', '\\r\\n', '\n', '\\n', '\r', '\\r'), ' ', $welcome_msg['subject']);
    120                         $welcome_msg['body'] = htmlspecialchars(wp_strip_all_tags(do_shortcode($welcome_msg['body'])));
    121                         $welcome_msg['body'] = str_replace(array('\r\n', '\\r\\n', '\n', '\\n', '\r', '\\r'), "\n", $welcome_msg['body']);
    122                         // Send message
    123                         if($welcome_msg['subject']) {
    124                             ejabat_get_xmpp_data('send_message', array('type' => 'normal', 'from' => $transient['host'], 'to' => $transient['username'].'@'.$transient['host'], 'subject' => $welcome_msg['subject'], 'body' => $welcome_msg['body']));
    125                         } else {
    126                             ejabat_get_xmpp_data('send_message', array('type' => 'chat', 'from' => $transient['host'], 'to' => $transient['username'].'@'.$transient['host'], 'body' => $welcome_msg['body']));
     103                // Verify required activation
     104                if(json_decode(ejabat_get_xmpp_data('get_ban_details', array('user' => $transient['username'], 'host' => $transient['host']))['body'])->reason == 'Activation required') {
     105                    // Try set correct password by unban account
     106                    $response = ejabat_get_xmpp_data('unban_account', array('user' => $transient['username'], 'host' => $transient['host']));
     107                    // Server unavailable
     108                    if(is_null($response)) {
     109                        $html = '<p class="ejabat"><span class="ejabat-info ejabat-error">'.__('Account activation failed because server is temporarily unavailable. Please try again in a moment.', 'ejabberd-account-tools').'</span></p>';
     110                    }
     111                    // Password changed
     112                    else if($response['code'] == 0) {
     113                        // Send welcome message
     114                        if(get_option('ejabat_welcome_msg', false)) {
     115                            // Get subject and body
     116                            $welcome_msg = apply_filters('ejabat_welcome_msg_args', array(
     117                                'subject' => get_option('ejabat_welcome_msg_subject'),
     118                                'body' => get_option('ejabat_welcome_msg_body')
     119                            ));
     120                            $welcome_msg['subject'] = htmlspecialchars(wp_strip_all_tags(do_shortcode($welcome_msg['subject'])));
     121                            $welcome_msg['subject'] = str_replace(array('\r\n', '\\r\\n', '\n', '\\n', '\r', '\\r'), ' ', $welcome_msg['subject']);
     122                            $welcome_msg['body'] = htmlspecialchars(wp_strip_all_tags(do_shortcode($welcome_msg['body'])));
     123                            $welcome_msg['body'] = str_replace(array('\r\n', '\\r\\n', '\n', '\\n', '\r', '\\r'), "\n", $welcome_msg['body']);
     124                            // Send message
     125                            if($welcome_msg['subject']) {
     126                                ejabat_get_xmpp_data('send_message', array('type' => 'normal', 'from' => $transient['host'], 'to' => $transient['username'].'@'.$transient['host'], 'subject' => $welcome_msg['subject'], 'body' => $welcome_msg['body']));
     127                            } else {
     128                                ejabat_get_xmpp_data('send_message', array('type' => 'chat', 'from' => $transient['host'], 'to' => $transient['username'].'@'.$transient['host'], 'body' => $welcome_msg['body']));
     129                            }
    127130                        }
    128                     }
    129                     // Activation watcher
    130                     if(get_option('ejabat_watch_activation', false) && get_option('ejabat_watcher')) {
    131                         $now = time();
    132                         $watchers = explode(' ', get_option('ejabat_watcher'));
    133                         foreach($watchers as $watcher) {
    134                             ejabat_get_xmpp_data('send_message', array('type' => 'chat', 'from' => $transient['host'], 'to' => $watcher, 'subject' => '', 'body' => sprintf('[%s] Account %s was activated from IP address %s', wp_date('Y-m-d H:i:s', $now), $transient['username'].'@'.$transient['host'], $_SERVER['REMOTE_ADDR'])));
     131                        // Activation watcher
     132                        if(get_option('ejabat_watch_activation', false) && get_option('ejabat_watcher')) {
     133                            $now = time();
     134                            $watchers = explode(' ', get_option('ejabat_watcher'));
     135                            foreach($watchers as $watcher) {
     136                                ejabat_get_xmpp_data('send_message', array('type' => 'chat', 'from' => $transient['host'], 'to' => $watcher, 'subject' => '', 'body' => sprintf('[%s] Account %s was activated from IP address %s', wp_date('Y-m-d H:i:s', $now), $transient['username'].'@'.$transient['host'], $_SERVER['REMOTE_ADDR'])));
     137                            }
    135138                        }
    136                     }
     139                        // Delete transient
     140                        delete_transient('ejabat_register_'.$request['code']);
     141                        // Success message
     142                        $html = '<p class="ejabat"><span class="ejabat-info ejabat-success">'.sprintf(__('Account %s has been successfully activated.', 'ejabberd-account-tools'),$transient['username'].'@'.$transient['host']).'</span></p>';
     143                    }
     144                    // Unexpected error
     145                    else {
     146                        $html = '<p class="ejabat"><span class="ejabat-info ejabat-error">'.__('Unexpected error occurred while attempting to activate account. Please try again.', 'ejabberd-account-tools').'</span></p>';
     147                    }
     148                }
     149                // Account already activated
     150                else {
    137151                    // Delete transient
    138152                    delete_transient('ejabat_register_'.$request['code']);
    139153                    // Success message
    140                     $html = '<p class="ejabat"><span class="ejabat-info ejabat-success">'.sprintf(__('Account %s has been successfully activated.', 'ejabberd-account-tools'),$transient['username'].'@'.$transient['host']).'</span></p>';
    141                 }
    142                 // Unexpected error
    143                 else {
    144                     $html = '<p class="ejabat"><span class="ejabat-info ejabat-error">'.__('Unexpected error occurred while attempting to activate account. Please try again.', 'ejabberd-account-tools').'</span></p>';
     154                    $html = '<p class="ejabat"><span class="ejabat-info ejabat-success">'.sprintf(__('Account %s has already been activated.', 'ejabberd-account-tools'),$transient['username'].'@'.$transient['host']).'</span></p>';
    145155                }
    146156            }
Note: See TracChangeset for help on using the changeset viewer.