@@ -556,14 +556,14 @@ |
||
556 | 556 | $tnow = get_str('tnow', true); |
557 | 557 | $ttok = get_str('ttok', true); |
558 | 558 | if (!$tnow) { |
559 | - if (isset($_POST['tnow'])) { |
|
560 | - $tnow = $_POST['tnow']; |
|
561 | - } |
|
559 | + if (isset($_POST['tnow'])) { |
|
560 | + $tnow = $_POST['tnow']; |
|
561 | + } |
|
562 | 562 | } |
563 | 563 | if (!$ttok) { |
564 | - if (isset($_POST['ttok'])) { |
|
565 | - $ttok = $_POST['ttok']; |
|
566 | - } |
|
564 | + if (isset($_POST['ttok'])) { |
|
565 | + $ttok = $_POST['ttok']; |
|
566 | + } |
|
567 | 567 | } |
568 | 568 | if (!$tnow) return false; |
569 | 569 | if (!$ttok) return false; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $apps = BoincApp::enum(""); |
156 | 156 | foreach ($apps as $app) { |
157 | 157 | if (in_array($app->id, $show_only) |
158 | - || ( in_array("all", $show_only) |
|
158 | + || (in_array("all", $show_only) |
|
159 | 159 | && (!$app->deprecated || $show_deprecated) |
160 | 160 | )) { |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <b>Results for <tt>$app->name</tt>:</b> |
164 | 164 | <ul> |
165 | 165 | "; |
166 | - for ($i=0; $i<2; $i++) { |
|
166 | + for ($i = 0; $i < 2; $i++) { |
|
167 | 167 | if ($i) { |
168 | 168 | $secs = 7*86400; |
169 | 169 | $period = " 7 days"; |
@@ -220,5 +220,5 @@ discard block |
||
220 | 220 | |
221 | 221 | admin_page_tail(); |
222 | 222 | |
223 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
223 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
224 | 224 | ?> |
@@ -286,11 +286,11 @@ |
||
286 | 286 | |
287 | 287 | require_once("../inc/account_ownership.inc"); |
288 | 288 | if (file_exists($account_ownership_private_key_file_path)) { |
289 | - // If the server has keys configured show the account ownership form |
|
290 | - row2( |
|
291 | - tra("Account Ownership"), |
|
292 | - "<a href=\"account_ownership.php?$url_tokens\">Generate ownership proof</a>" |
|
293 | - ); |
|
289 | + // If the server has keys configured show the account ownership form |
|
290 | + row2( |
|
291 | + tra("Account Ownership"), |
|
292 | + "<a href=\"account_ownership.php?$url_tokens\">Generate ownership proof</a>" |
|
293 | + ); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | } |
@@ -23,15 +23,15 @@ |
||
23 | 23 | require_once("../inc/account_ownership.inc"); |
24 | 24 | |
25 | 25 | if (!file_exists($account_ownership_private_key_file_path)) { |
26 | - echo "<p>The '$account_ownership_private_key_file_name' key <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the BOINC web server command line."; |
|
26 | + echo "<p>The '$account_ownership_private_key_file_name' key <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the BOINC web server command line."; |
|
27 | 27 | } else { |
28 | - echo "<p>The '$account_ownership_private_key_file_name' key exists."; |
|
28 | + echo "<p>The '$account_ownership_private_key_file_name' key exists."; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (!file_exists($account_ownership_public_key_file_path)) { |
32 | - echo "<p>The '$account_ownership_public_key_file_name' key <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the BOINC web server command line."; |
|
32 | + echo "<p>The '$account_ownership_public_key_file_name' key <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the BOINC web server command line."; |
|
33 | 33 | } else { |
34 | - echo "<p>The '$account_ownership_public_key_file_name' key exists."; |
|
34 | + echo "<p>The '$account_ownership_public_key_file_name' key exists."; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | echo "<p>For more info see the related wiki page: <a href=\"https://boinc.berkeley.edu/trac/wiki/ProofOfOwnership\">ProofOfOwnership</a></p>" |
@@ -24,50 +24,50 @@ |
||
24 | 24 | require_once("../inc/account_ownership.inc"); |
25 | 25 | |
26 | 26 | if (php_sapi_name() == "cli") { |
27 | - if (!empty($argv[1])) { |
|
27 | + if (!empty($argv[1])) { |
|
28 | 28 | if ($argv[1] == "overwrite") { |
29 | - if (file_exists($account_ownership_private_key_file_path)) { |
|
29 | + if (file_exists($account_ownership_private_key_file_path)) { |
|
30 | 30 | // If the private key exists, delete it. |
31 | 31 | unlink($account_ownership_private_key); |
32 | 32 | echo "erased '$account_ownership_private_key_file_name' \n"; |
33 | - } |
|
34 | - if (file_exists($account_ownership_public_key_file_path)) { |
|
33 | + } |
|
34 | + if (file_exists($account_ownership_public_key_file_path)) { |
|
35 | 35 | // If the public key exists, delete it. |
36 | 36 | unlink($account_ownership_public_key); |
37 | 37 | echo "erased '$account_ownership_public_key_file_name' \n"; |
38 | - } |
|
38 | + } |
|
39 | + } |
|
39 | 40 | } |
40 | - } |
|
41 | 41 | |
42 | - if ((!file_exists($account_ownership_private_key_file_path)) && (!file_exists($account_ownership_public_key_file_path))) { |
|
42 | + if ((!file_exists($account_ownership_private_key_file_path)) && (!file_exists($account_ownership_public_key_file_path))) { |
|
43 | 43 | |
44 | 44 | try { |
45 | - $generated_pkey = openssl_pkey_new(array( |
|
45 | + $generated_pkey = openssl_pkey_new(array( |
|
46 | 46 | 'digest_alg' => 'sha512', |
47 | 47 | 'private_key_bits' => 4096, |
48 | 48 | 'private_key_type' => OPENSSL_KEYTYPE_RSA |
49 | - )); |
|
49 | + )); |
|
50 | 50 | |
51 | - $pubkey = openssl_pkey_get_details($generated_pkey); // Get the public key from the generated pkey pair |
|
52 | - file_put_contents($account_ownership_public_key, $pubkey['key']); // Save the public key to disk |
|
53 | - openssl_pkey_export_to_file($generated_pkey, $account_ownership_private_key); // Save the private key to disk |
|
54 | - openssl_pkey_free($generated_pkey); // Free key data securely from memory |
|
51 | + $pubkey = openssl_pkey_get_details($generated_pkey); // Get the public key from the generated pkey pair |
|
52 | + file_put_contents($account_ownership_public_key, $pubkey['key']); // Save the public key to disk |
|
53 | + openssl_pkey_export_to_file($generated_pkey, $account_ownership_private_key); // Save the private key to disk |
|
54 | + openssl_pkey_free($generated_pkey); // Free key data securely from memory |
|
55 | 55 | |
56 | - if ((file_exists($account_ownership_private_key_file_path)) && (file_exists($account_ownership_public_key_file_path))) { |
|
56 | + if ((file_exists($account_ownership_private_key_file_path)) && (file_exists($account_ownership_public_key_file_path))) { |
|
57 | 57 | echo "Successfully generated a new account ownership keypair."; |
58 | - } else { |
|
58 | + } else { |
|
59 | 59 | throw new Exception('Failed to generate account ownership keypair.'); |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | } catch (Exception $e) { |
63 | 63 | echo 'Caught exception during account ownership key generation: ', $e->getMessage(), "\n"; |
64 | 64 | } |
65 | 65 | |
66 | - } else { |
|
66 | + } else { |
|
67 | 67 | echo "The private and public keys already exist. Repeat the command with the 'overwrite' parameter to replace the existing ownership keys."; |
68 | - } |
|
68 | + } |
|
69 | 69 | } else { |
70 | - echo "This script must be run from the CLI"; |
|
70 | + echo "This script must be run from the CLI"; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | ?> |
@@ -60,7 +60,7 @@ |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | } catch (Exception $e) { |
63 | - echo 'Caught exception during account ownership key generation: ', $e->getMessage(), "\n"; |
|
63 | + echo 'Caught exception during account ownership key generation: ', $e->getMessage(), "\n"; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } else { |
@@ -28,140 +28,140 @@ |
||
28 | 28 | check_tokens($user->authenticator); |
29 | 29 | |
30 | 30 | function account_ownership_action($user) { |
31 | - // POST request - the user has submitted the form. |
|
32 | - page_head(tra("Proof of account ownership results"), null, null, null, boinc_recaptcha_get_head_extra()); |
|
33 | - |
|
34 | - global $recaptcha_private_key; |
|
35 | - if ($recaptcha_private_key) { |
|
36 | - // Recaptcha is enabled on the BOINC server |
|
37 | - if (!boinc_recaptcha_isValidated($recaptcha_private_key)) { |
|
38 | - // The user failed to solve the recaptcha prompt - redirect them to an error message! |
|
39 | - error_page( |
|
40 | - tra("Your reCAPTCHA response was not correct. Please try again.") |
|
41 | - ); |
|
42 | - } |
|
43 | - } |
|
44 | - |
|
45 | - // Input is passed in from the openssl_sign_form |
|
46 | - $user_data = htmlentities(post_str("user_data", true), ENT_QUOTES, "UTF-8"); // Convert special characters to html equivelant |
|
47 | - |
|
48 | - if ((strlen($user_data) > 0) && (strlen($user_data) <= 4096)) { |
|
49 | - require_once("../inc/account_ownership.inc"); |
|
50 | - // Check that the private key file exists where specified. If not, redirect to error page. |
|
51 | - if (!file_exists($account_ownership_private_key_file_path)) { |
|
52 | - error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
53 | - } |
|
54 | - |
|
55 | - // Check that the public key file exists where specified. If not, redirect to error page. |
|
56 | - if (!file_exists($account_ownership_public_key_file_path)) { |
|
57 | - error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
58 | - } |
|
59 | - |
|
60 | - $privkey = fopen($account_ownership_private_key_file_path, "r"); // Opening private key file |
|
61 | - if (!isset($privkey) || empty($privkey)) { |
|
31 | + // POST request - the user has submitted the form. |
|
32 | + page_head(tra("Proof of account ownership results"), null, null, null, boinc_recaptcha_get_head_extra()); |
|
33 | + |
|
34 | + global $recaptcha_private_key; |
|
35 | + if ($recaptcha_private_key) { |
|
36 | + // Recaptcha is enabled on the BOINC server |
|
37 | + if (!boinc_recaptcha_isValidated($recaptcha_private_key)) { |
|
38 | + // The user failed to solve the recaptcha prompt - redirect them to an error message! |
|
39 | + error_page( |
|
40 | + tra("Your reCAPTCHA response was not correct. Please try again.") |
|
41 | + ); |
|
42 | + } |
|
43 | + } |
|
44 | + |
|
45 | + // Input is passed in from the openssl_sign_form |
|
46 | + $user_data = htmlentities(post_str("user_data", true), ENT_QUOTES, "UTF-8"); // Convert special characters to html equivelant |
|
47 | + |
|
48 | + if ((strlen($user_data) > 0) && (strlen($user_data) <= 4096)) { |
|
49 | + require_once("../inc/account_ownership.inc"); |
|
50 | + // Check that the private key file exists where specified. If not, redirect to error page. |
|
51 | + if (!file_exists($account_ownership_private_key_file_path)) { |
|
52 | + error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
53 | + } |
|
54 | + |
|
55 | + // Check that the public key file exists where specified. If not, redirect to error page. |
|
56 | + if (!file_exists($account_ownership_public_key_file_path)) { |
|
57 | + error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
58 | + } |
|
59 | + |
|
60 | + $privkey = fopen($account_ownership_private_key_file_path, "r"); // Opening private key file |
|
61 | + if (!isset($privkey) || empty($privkey)) { |
|
62 | 62 | error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
63 | - } |
|
64 | - $privkey_contents = fread($privkey, 8192); // Reading contents of private key into var |
|
65 | - fclose($privkey); // Closing private key file |
|
63 | + } |
|
64 | + $privkey_contents = fread($privkey, 8192); // Reading contents of private key into var |
|
65 | + fclose($privkey); // Closing private key file |
|
66 | 66 | |
67 | - $userid = $user->id; // Retrieving the user's UserId |
|
68 | - $message_data = "$userid $user_data"; // Create the message which will be signed. |
|
67 | + $userid = $user->id; // Retrieving the user's UserId |
|
68 | + $message_data = "$userid $user_data"; // Create the message which will be signed. |
|
69 | 69 | |
70 | - $private_key_pem = openssl_pkey_get_private($privkey_contents); // Loading the private key into memory |
|
71 | - openssl_sign($message_data, $signature, $private_key_pem, OPENSSL_ALGO_SHA512); // Compute signature using SHA512 |
|
72 | - openssl_free_key($private_key_pem); // Free the private key from memory for additional security |
|
70 | + $private_key_pem = openssl_pkey_get_private($privkey_contents); // Loading the private key into memory |
|
71 | + openssl_sign($message_data, $signature, $private_key_pem, OPENSSL_ALGO_SHA512); // Compute signature using SHA512 |
|
72 | + openssl_free_key($private_key_pem); // Free the private key from memory for additional security |
|
73 | 73 | |
74 | - $pubkey = fopen($account_ownership_public_key_file_path, "r"); // Open public key file |
|
75 | - if ((!isset($pubkey)) || empty($pubkey)) { |
|
74 | + $pubkey = fopen($account_ownership_public_key_file_path, "r"); // Open public key file |
|
75 | + if ((!isset($pubkey)) || empty($pubkey)) { |
|
76 | 76 | error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
77 | - } |
|
78 | - $pubkey_contents = fread($pubkey, 8192); // Read contents to var |
|
79 | - fclose($pubkey); // Close pub key file |
|
80 | - |
|
81 | - $base64_sig = base64_encode($signature); // Base64 encode the generated signature to enable safe output to text file. |
|
82 | - $decoded_sig = base64_decode($base64_sig); // Decode base64 sig for use in sig_verification |
|
83 | - $pubkeyid = openssl_pkey_get_public($pubkey_contents); // fetch public key into memory |
|
84 | - $sig_verification = openssl_verify($message_data, $decoded_sig, $pubkeyid, OPENSSL_ALGO_SHA512); // Verify that the generated signature against the original data, using the public key. |
|
85 | - openssl_free_key($pubkeyid); // Free the public key from memory |
|
86 | - |
|
87 | - // Check if signature was successfully validated |
|
88 | - if ($sig_verification == 1) { |
|
89 | - $url_tokens = url_tokens($user->authenticator); |
|
90 | - // The generated signature has been successfully verified using the public key. |
|
91 | - global $master_url; // Define global master_url variable for use in output |
|
92 | - echo "<p>Do not share this information with anyone other than the external system which has requested this proof of account ownership.</p>"; |
|
93 | - echo "<textarea rows='13' cols='50' id='result_textbox'><account_ownership_verification>\n<master_url>$master_url</master_url>\n<msg>$message_data</msg>\n<signature>$base64_sig</signature>\n</account_ownership_verification></textarea>"; |
|
94 | - echo "<br/><br/><button class='btn btn-success' onclick='copy_result_textbox()'>Copy text</button>"; |
|
95 | - echo "<a href='account_ownership.php?$url_tokens'><button class='btn btn-default'>Go back</button></a>"; |
|
96 | - echo '<script type="text/javascript">'; |
|
97 | - echo 'function copy_result_textbox() { |
|
77 | + } |
|
78 | + $pubkey_contents = fread($pubkey, 8192); // Read contents to var |
|
79 | + fclose($pubkey); // Close pub key file |
|
80 | + |
|
81 | + $base64_sig = base64_encode($signature); // Base64 encode the generated signature to enable safe output to text file. |
|
82 | + $decoded_sig = base64_decode($base64_sig); // Decode base64 sig for use in sig_verification |
|
83 | + $pubkeyid = openssl_pkey_get_public($pubkey_contents); // fetch public key into memory |
|
84 | + $sig_verification = openssl_verify($message_data, $decoded_sig, $pubkeyid, OPENSSL_ALGO_SHA512); // Verify that the generated signature against the original data, using the public key. |
|
85 | + openssl_free_key($pubkeyid); // Free the public key from memory |
|
86 | + |
|
87 | + // Check if signature was successfully validated |
|
88 | + if ($sig_verification == 1) { |
|
89 | + $url_tokens = url_tokens($user->authenticator); |
|
90 | + // The generated signature has been successfully verified using the public key. |
|
91 | + global $master_url; // Define global master_url variable for use in output |
|
92 | + echo "<p>Do not share this information with anyone other than the external system which has requested this proof of account ownership.</p>"; |
|
93 | + echo "<textarea rows='13' cols='50' id='result_textbox'><account_ownership_verification>\n<master_url>$master_url</master_url>\n<msg>$message_data</msg>\n<signature>$base64_sig</signature>\n</account_ownership_verification></textarea>"; |
|
94 | + echo "<br/><br/><button class='btn btn-success' onclick='copy_result_textbox()'>Copy text</button>"; |
|
95 | + echo "<a href='account_ownership.php?$url_tokens'><button class='btn btn-default'>Go back</button></a>"; |
|
96 | + echo '<script type="text/javascript">'; |
|
97 | + echo 'function copy_result_textbox() { |
|
98 | 98 | var target_textbox = document.getElementById("result_textbox"); |
99 | 99 | target_textbox.select(); |
100 | 100 | document.execCommand("copy"); |
101 | 101 | alert("Copied to clipboard"); |
102 | 102 | }'; |
103 | - echo '</script>'; |
|
104 | - page_tail(); |
|
105 | - |
|
106 | - } elseif ($sig_verification == 0) { |
|
107 | - // The generated signature has not been verified. The private/public keys do not match. |
|
108 | - error_page(tra("Signature verification failed. Contact the project administrator to resolve the issue.")); |
|
109 | - } else { |
|
110 | - // Something has gone wrong & an error has occurred. |
|
111 | - error_page(tra("An error occured during the signature verification. Contact the project administrator to resolve the issue.")); |
|
112 | - } |
|
113 | - } else { |
|
114 | - // User data input invalid |
|
115 | - error_page(tra("Invalid input. User input must have a length > 0 and < 4096. <form><input type='button' value='Go back!'' onclick='history.back()'></form>")); |
|
116 | - } |
|
103 | + echo '</script>'; |
|
104 | + page_tail(); |
|
105 | + |
|
106 | + } elseif ($sig_verification == 0) { |
|
107 | + // The generated signature has not been verified. The private/public keys do not match. |
|
108 | + error_page(tra("Signature verification failed. Contact the project administrator to resolve the issue.")); |
|
109 | + } else { |
|
110 | + // Something has gone wrong & an error has occurred. |
|
111 | + error_page(tra("An error occured during the signature verification. Contact the project administrator to resolve the issue.")); |
|
112 | + } |
|
113 | + } else { |
|
114 | + // User data input invalid |
|
115 | + error_page(tra("Invalid input. User input must have a length > 0 and < 4096. <form><input type='button' value='Go back!'' onclick='history.back()'></form>")); |
|
116 | + } |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | function account_ownership_form($user) { |
120 | - // GET request - the user has navigated to the page. |
|
121 | - page_head(tra("Generate proof of account ownership"), null, null, null, boinc_recaptcha_get_head_extra()); |
|
122 | - |
|
123 | - if ($user) { // Verify the user is logged in |
|
124 | - require_once("../inc/account_ownership.inc"); |
|
125 | - |
|
126 | - if (!file_exists($account_ownership_private_key_file_path)) { |
|
127 | - // Check that the private key file exists where specified. If not, redirect to error page. |
|
128 | - error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
129 | - } |
|
130 | - |
|
131 | - if (!file_exists($account_ownership_public_key_file_path)) { |
|
132 | - // Check that the public key file exists where specified. If not, redirect to error page. |
|
133 | - error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
134 | - } |
|
135 | - |
|
136 | - echo "<p>This tool is designed to create a proof of account ownership for external systems.</p>"; |
|
137 | - |
|
138 | - global $recaptcha_public_key; |
|
139 | - if ($recaptcha_public_key) { |
|
140 | - // Recaptcha configured |
|
141 | - echo "<p>Enter a message with length less than 4096 characters into the input textbox below, solve the captcha then click the 'Generate' button.</p>"; |
|
142 | - } else { |
|
143 | - // Recaptcha not configured |
|
144 | - echo "<p>Enter a message with length less than 4096 characters into the input textbox below then click the 'Generate' button.</p>"; |
|
145 | - } |
|
146 | - echo "<p>A textbox will then appear which contains your proof of account ownership."; |
|
147 | - echo "<form method=post action=account_ownership.php>"; |
|
148 | - |
|
149 | - echo form_tokens($user->authenticator); |
|
150 | - echo "<textarea rows='4' cols='50' name=user_data type=text size=20 placeholder='Enter text'></textarea><br/><br/>"; |
|
151 | - |
|
152 | - if ($recaptcha_public_key) { |
|
153 | - // Trigger recaptcha! |
|
154 | - form_general("", boinc_recaptcha_get_html($recaptcha_public_key)); |
|
155 | - } |
|
156 | - |
|
157 | - echo "<input class=\"btn btn-success\" type=submit value='".tra("Generate")."'>"; |
|
158 | - echo "</form><br/><hr/>"; |
|
159 | - } else { |
|
160 | - // The user is not logged in! |
|
161 | - echo "<p>You need to be logged in to use this functionality.</p>"; |
|
162 | - } |
|
163 | - |
|
164 | - page_tail(); |
|
120 | + // GET request - the user has navigated to the page. |
|
121 | + page_head(tra("Generate proof of account ownership"), null, null, null, boinc_recaptcha_get_head_extra()); |
|
122 | + |
|
123 | + if ($user) { // Verify the user is logged in |
|
124 | + require_once("../inc/account_ownership.inc"); |
|
125 | + |
|
126 | + if (!file_exists($account_ownership_private_key_file_path)) { |
|
127 | + // Check that the private key file exists where specified. If not, redirect to error page. |
|
128 | + error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
129 | + } |
|
130 | + |
|
131 | + if (!file_exists($account_ownership_public_key_file_path)) { |
|
132 | + // Check that the public key file exists where specified. If not, redirect to error page. |
|
133 | + error_page(tra("The proof of account ownership feature is not set up properly. Contact the project administrator to resolve the issue.")); |
|
134 | + } |
|
135 | + |
|
136 | + echo "<p>This tool is designed to create a proof of account ownership for external systems.</p>"; |
|
137 | + |
|
138 | + global $recaptcha_public_key; |
|
139 | + if ($recaptcha_public_key) { |
|
140 | + // Recaptcha configured |
|
141 | + echo "<p>Enter a message with length less than 4096 characters into the input textbox below, solve the captcha then click the 'Generate' button.</p>"; |
|
142 | + } else { |
|
143 | + // Recaptcha not configured |
|
144 | + echo "<p>Enter a message with length less than 4096 characters into the input textbox below then click the 'Generate' button.</p>"; |
|
145 | + } |
|
146 | + echo "<p>A textbox will then appear which contains your proof of account ownership."; |
|
147 | + echo "<form method=post action=account_ownership.php>"; |
|
148 | + |
|
149 | + echo form_tokens($user->authenticator); |
|
150 | + echo "<textarea rows='4' cols='50' name=user_data type=text size=20 placeholder='Enter text'></textarea><br/><br/>"; |
|
151 | + |
|
152 | + if ($recaptcha_public_key) { |
|
153 | + // Trigger recaptcha! |
|
154 | + form_general("", boinc_recaptcha_get_html($recaptcha_public_key)); |
|
155 | + } |
|
156 | + |
|
157 | + echo "<input class=\"btn btn-success\" type=submit value='".tra("Generate")."'>"; |
|
158 | + echo "</form><br/><hr/>"; |
|
159 | + } else { |
|
160 | + // The user is not logged in! |
|
161 | + echo "<p>You need to be logged in to use this functionality.</p>"; |
|
162 | + } |
|
163 | + |
|
164 | + page_tail(); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
@@ -120,7 +120,8 @@ |
||
120 | 120 | // GET request - the user has navigated to the page. |
121 | 121 | page_head(tra("Generate proof of account ownership"), null, null, null, boinc_recaptcha_get_head_extra()); |
122 | 122 | |
123 | - if ($user) { // Verify the user is logged in |
|
123 | + if ($user) { |
|
124 | +// Verify the user is logged in |
|
124 | 125 | require_once("../inc/account_ownership.inc"); |
125 | 126 | |
126 | 127 | if (!file_exists($account_ownership_private_key_file_path)) { |