1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// This file is part of BOINC. |
4
|
|
|
// http://boinc.berkeley.edu |
5
|
|
|
// Copyright (C) 2018 University of California |
6
|
|
|
// |
7
|
|
|
// BOINC is free software; you can redistribute it and/or modify it |
8
|
|
|
// under the terms of the GNU Lesser General Public License |
9
|
|
|
// as published by the Free Software Foundation, |
10
|
|
|
// either version 3 of the License, or (at your option) any later version. |
11
|
|
|
// |
12
|
|
|
// BOINC is distributed in the hope that it will be useful, |
13
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15
|
|
|
// See the GNU Lesser General Public License for more details. |
16
|
|
|
// |
17
|
|
|
// You should have received a copy of the GNU Lesser General Public License |
18
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
19
|
|
|
|
20
|
|
|
// signup.php: form for creating an account. |
21
|
|
|
// Goes to the download page after that. |
22
|
|
|
|
23
|
|
|
require_once("../inc/util.inc"); |
24
|
|
|
require_once("../inc/user_util.inc"); |
25
|
|
|
require_once("../inc/account.inc"); |
26
|
|
|
require_once("../inc/recaptchalib.inc"); |
27
|
|
|
|
28
|
|
|
function join_form() { |
29
|
|
|
// Using invitation codes to restrict access? |
30
|
|
|
// |
31
|
|
|
if (defined('INVITE_CODES')) { |
32
|
|
|
form_input_text( |
33
|
|
|
sprintf('<span title="%s">%s</span>', |
34
|
|
|
tra("An invitation code is required to create an account."), |
35
|
|
|
tra("Invitation code") |
36
|
|
|
), |
37
|
|
|
"invite_code" |
38
|
|
|
); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
form_input_text( |
42
|
|
|
sprintf('<span title="%s">%s</span>', |
43
|
|
|
tra("Identifies you on this web site. Use your real name or a nickname."), |
44
|
|
|
tra("Choose screen name") |
45
|
|
|
), |
46
|
|
|
"new_name" |
47
|
|
|
); |
48
|
|
|
form_input_text( |
49
|
|
|
sprintf('<span title="%s">%s</span>', |
50
|
|
|
tra("An address where you can receive emails."), |
51
|
|
|
tra("Your email address") |
52
|
|
|
), |
53
|
|
|
"new_email_addr" |
54
|
|
|
); |
55
|
|
|
$min_passwd_length = parse_element(get_config(), "<min_passwd_length>"); |
56
|
|
|
if (!$min_passwd_length) { |
57
|
|
|
$min_passwd_length = 6; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
form_input_text( |
61
|
|
|
sprintf('<span title="%s">%s</span>', |
62
|
|
|
tra("Must be at least %1 characters", $min_passwd_length), |
63
|
|
|
tra("Choose password") |
64
|
|
|
), |
65
|
|
|
"passwd", "", "password", 'id="passwd"', |
66
|
|
|
passwd_visible_checkbox("passwd") |
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
// move this somewhere else |
71
|
|
|
// |
72
|
|
|
function global_prefs_form() { |
73
|
|
|
form_radio_buttons( |
74
|
|
|
"Use of your computer", |
75
|
|
|
"preset", |
76
|
|
|
array( |
77
|
|
|
array('green', "Green - limit power consumption"), |
78
|
|
|
array('standard', "Standard"), |
79
|
|
|
array('max', "Maximum"), |
80
|
|
|
), |
81
|
|
|
'standard' |
82
|
|
|
); |
83
|
|
|
} |
84
|
|
|
function show_join_form() { |
85
|
|
|
page_head( |
86
|
|
|
sprintf("%s %s", tra("Join"), PROJECT), |
87
|
|
|
null, null, null, boinc_recaptcha_get_head_extra() |
88
|
|
|
); |
89
|
|
|
form_start("signup.php", "post"); |
90
|
|
|
form_input_hidden("action", "join"); |
91
|
|
|
join_form(); |
92
|
|
|
//global_prefs_form(); |
93
|
|
|
if (recaptcha_public_key()) { |
94
|
|
|
form_general("", boinc_recaptcha_get_html(recaptcha_public_key())); |
95
|
|
|
} |
96
|
|
|
form_submit(tra("Join")); |
97
|
|
|
form_end(); |
98
|
|
|
page_tail(); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
function join_action() { |
102
|
|
|
$user = validate_post_make_user(); |
103
|
|
|
if (!$user) { |
104
|
|
|
error_page("Couldn't create user record"); |
105
|
|
|
} |
106
|
|
|
$preset = post_str("preset", true); |
107
|
|
|
if ($preset) { |
108
|
|
|
$prefs = compute_prefs_xml($preset); |
109
|
|
|
$user->update("global_prefs='$prefs'"); |
110
|
|
|
} |
111
|
|
|
Header("Location: download_software.php"); |
|
|
|
|
112
|
|
|
send_cookie('auth', $user->authenticator, false); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
$action = post_str('action', true); |
116
|
|
|
if ($action == "join") { |
117
|
|
|
join_action(); |
118
|
|
|
} else { |
119
|
|
|
show_join_form(); |
120
|
|
|
} |
121
|
|
|
?> |
122
|
|
|
|