|
12 | 12 |
|
13 | 13 | if ($user->isAuthenticated()) { |
14 | 14 | if ($config['twofactor']['enabled']) { |
15 | | - $popupmsg = 'E-mail confirmations are required for '; |
16 | | - $popuptypes = array(); |
17 | | - if ($config['twofactor']['options']['details'] && $oldtoken_ea !== "") { |
18 | | - $popuptypes[] = 'editing your details'; |
19 | | - $ea_editable = $user->token->isTokenValid($_SESSION['USERDATA']['id'], $oldtoken_ea, 5); |
20 | | - $ea_sent = $user->token->doesTokenExist('account_edit', $_SESSION['USERDATA']['id']); |
21 | | - } |
22 | | - if ($config['twofactor']['options']['changepw'] && $oldtoken_cp !== "") { |
23 | | - $popuptypes[] = 'changing your password'; |
24 | | - $cp_editable = $user->token->isTokenValid($_SESSION['USERDATA']['id'], $oldtoken_cp, 6); |
25 | | - $cp_sent = $user->token->doesTokenExist('change_pw', $_SESSION['USERDATA']['id']); |
26 | | - } |
27 | | - if ($config['twofactor']['options']['withdraw'] && $oldtoken_wf !== "") { |
28 | | - $popuptypes[] = 'withdrawals'; |
29 | | - $wf_editable = $user->token->isTokenValid($_SESSION['USERDATA']['id'], $oldtoken_wf, 7); |
30 | | - $wf_sent = $user->token->doesTokenExist('withdraw_funds', $_SESSION['USERDATA']['id']); |
31 | | - } |
| 15 | + if ($config['twofactor']['options']['details'] OR $config['twofactor']['options']['changepw'] OR $config['twofactor']['options']['withdraw']) { |
| 16 | + $popupmsg = 'E-mail confirmations are required for '; |
| 17 | + $popuptypes = array(); |
| 18 | + if ($config['twofactor']['options']['details'] && $oldtoken_ea !== "") { |
| 19 | + $popuptypes[] = 'editing your details'; |
| 20 | + $ea_editable = $user->token->isTokenValid($_SESSION['USERDATA']['id'], $oldtoken_ea, 5); |
| 21 | + $ea_sent = $user->token->doesTokenExist('account_edit', $_SESSION['USERDATA']['id']); |
| 22 | + } |
| 23 | + if ($config['twofactor']['options']['changepw'] && $oldtoken_cp !== "") { |
| 24 | + $popuptypes[] = 'changing your password'; |
| 25 | + $cp_editable = $user->token->isTokenValid($_SESSION['USERDATA']['id'], $oldtoken_cp, 6); |
| 26 | + $cp_sent = $user->token->doesTokenExist('change_pw', $_SESSION['USERDATA']['id']); |
| 27 | + } |
| 28 | + if ($config['twofactor']['options']['withdraw'] && $oldtoken_wf !== "") { |
| 29 | + $popuptypes[] = 'withdrawals'; |
| 30 | + $wf_editable = $user->token->isTokenValid($_SESSION['USERDATA']['id'], $oldtoken_wf, 7); |
| 31 | + $wf_sent = $user->token->doesTokenExist('withdraw_funds', $_SESSION['USERDATA']['id']); |
| 32 | + } |
32 | 33 |
|
33 | | - // get the status of a token if set |
34 | | - $message_tokensent_invalid = 'A token was sent to your e-mail that will allow you to '; |
35 | | - $message_tokensent_valid = 'You can currently '; |
36 | | - $messages_tokensent_status = array( |
37 | | - 'ea' => 'edit your account details', |
38 | | - 'wf' => 'withdraw funds', |
39 | | - 'cp' => 'change your password' |
40 | | - ); |
41 | | - // build the message we're going to show them for their token(s) |
42 | | - $eaprep_sent = ($ea_sent) ? $message_tokensent_valid.$messages_tokensent_status['ea'] : ""; |
43 | | - $eaprep_edit = ($ea_editable) ? $message_tokensent_invalid.$messages_tokensent_status['ea'] : ""; |
44 | | - $wfprep_sent = ($wf_sent) ? $message_tokensent_valid.$messages_tokensent_status['wf'] : ""; |
45 | | - $wfprep_edit = ($wf_editable) ? $message_tokensent_invalid.$messages_tokensent_status['wf'] : ""; |
46 | | - $cpprep_sent = ($cp_sent) ? $message_tokensent_valid.$messages_tokensent_status['cp'] : ""; |
47 | | - $cpprep_edit = ($cp_editable) ? $message_tokensent_invalid.$messages_tokensent_status['cp'] : ""; |
48 | | - $ptc = 0; |
49 | | - $ptcn = count($popuptypes); |
50 | | - foreach ($popuptypes as $pt) { |
51 | | - if ($ptcn == 1) { $popupmsg.= $popuptypes[$ptc]; continue; } |
52 | | - if ($ptc !== ($ptcn-1)) { |
53 | | - $popupmsg.= $popuptypes[$ptc].', '; |
54 | | - } else { |
55 | | - $popupmsg.= 'and '.$popuptypes[$ptc]; |
| 34 | + // get the status of a token if set |
| 35 | + $message_tokensent_invalid = 'A token was sent to your e-mail that will allow you to '; |
| 36 | + $message_tokensent_valid = 'You can currently '; |
| 37 | + $messages_tokensent_status = array( |
| 38 | + 'ea' => 'edit your account details', |
| 39 | + 'wf' => 'withdraw funds', |
| 40 | + 'cp' => 'change your password' |
| 41 | + ); |
| 42 | + // build the message we're going to show them for their token(s) |
| 43 | + $eaprep_sent = ($ea_sent) ? $message_tokensent_valid.$messages_tokensent_status['ea'] : ""; |
| 44 | + $eaprep_edit = ($ea_editable) ? $message_tokensent_invalid.$messages_tokensent_status['ea'] : ""; |
| 45 | + $wfprep_sent = ($wf_sent) ? $message_tokensent_valid.$messages_tokensent_status['wf'] : ""; |
| 46 | + $wfprep_edit = ($wf_editable) ? $message_tokensent_invalid.$messages_tokensent_status['wf'] : ""; |
| 47 | + $cpprep_sent = ($cp_sent) ? $message_tokensent_valid.$messages_tokensent_status['cp'] : ""; |
| 48 | + $cpprep_edit = ($cp_editable) ? $message_tokensent_invalid.$messages_tokensent_status['cp'] : ""; |
| 49 | + $ptc = 0; |
| 50 | + $ptcn = count($popuptypes); |
| 51 | + foreach ($popuptypes as $pt) { |
| 52 | + if ($ptcn == 1) { $popupmsg.= $popuptypes[$ptc]; continue; } |
| 53 | + if ($ptc !== ($ptcn-1)) { |
| 54 | + $popupmsg.= $popuptypes[$ptc].', '; |
| 55 | + } else { |
| 56 | + $popupmsg.= 'and '.$popuptypes[$ptc]; |
| 57 | + } |
| 58 | + $ptc++; |
56 | 59 | } |
57 | | - $ptc++; |
| 60 | + // display global notice about tokens being in use and for which bits they're active |
| 61 | + $_SESSION['POPUP'][] = array('CONTENT' => $popupmsg, 'TYPE' => 'alert alert-warning'); |
58 | 62 | } |
59 | | - // display global notice about tokens being in use and for which bits they're active |
60 | | - $_SESSION['POPUP'][] = array('CONTENT' => $popupmsg, 'TYPE' => 'alert alert-warning'); |
61 | 63 | } |
62 | 64 |
|
63 | 65 | if (isset($_POST['do']) && $_POST['do'] == 'genPin') { |
|
174 | 176 | } |
175 | 177 |
|
176 | 178 | // display token info per each - only when sent and editable or just sent, not by default |
177 | | - (!empty($eaprep_sent) && !empty($eaprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $eaprep_sent, 'TYPE' => 'success'):""; |
178 | | - (!empty($eaprep_sent) && empty($eaprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $message_tokensent_invalid.$messages_tokensent_status['ea'], 'TYPE' => 'success'):""; |
179 | | - (!empty($wfprep_sent) && !empty($wfprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $wfprep_sent, 'TYPE' => 'success'):""; |
180 | | - (!empty($wfprep_sent) && empty($wfprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $message_tokensent_invalid.$messages_tokensent_status['wf'], 'TYPE' => 'success'):""; |
181 | | - (!empty($cpprep_sent) && !empty($cpprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $cpprep_sent, 'TYPE' => 'success'):""; |
182 | | - (!empty($cpprep_sent) && empty($cpprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $message_tokensent_invalid.$messages_tokensent_status['cp'], 'TYPE' => 'success'):""; |
| 179 | + (!empty($eaprep_sent) && !empty($eaprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $eaprep_sent, 'TYPE' => 'alert alert-success'):""; |
| 180 | + (!empty($eaprep_sent) && empty($eaprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $message_tokensent_invalid.$messages_tokensent_status['ea'], 'TYPE' => 'alert alert-success'):""; |
| 181 | + (!empty($wfprep_sent) && !empty($wfprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $wfprep_sent, 'TYPE' => 'alert alert-success'):""; |
| 182 | + (!empty($wfprep_sent) && empty($wfprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $message_tokensent_invalid.$messages_tokensent_status['wf'], 'TYPE' => 'alert alert-success'):""; |
| 183 | + (!empty($cpprep_sent) && !empty($cpprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $cpprep_sent, 'TYPE' => 'alert alert-success'):""; |
| 184 | + (!empty($cpprep_sent) && empty($cpprep_edit)) ? $_SESSION['POPUP'][] = array('CONTENT' => $message_tokensent_invalid.$messages_tokensent_status['cp'], 'TYPE' => 'alert alert-success'):""; |
183 | 185 | // two-factor stuff |
184 | 186 | $smarty->assign("CHANGEPASSUNLOCKED", $cp_editable); |
185 | 187 | $smarty->assign("WITHDRAWUNLOCKED", $wf_editable); |
|
0 commit comments