*.sh: remove hard-coded bits with config.pl
[girocco/ztw.git] / cgi / reguser.cgi
blobbc0081de361af58dbadb6926e4ff802ece7120d8
1 #!/usr/bin/perl
2 # (c) Petr Baudis <pasky@suse.cz>
3 # GPLv2
5 use strict;
6 use warnings;
8 use lib qw(/home/repo/repomgr/cgi);
9 use Git::RepoCGI;
11 my $repo = Git::RepoCGI->new('User Registration');
13 $repo->bye("<p>Go away, bot.</p>") if $repo->sparam('mail');
15 if ($repo->sparam('y0')) {
16 # submitted, let's see
17 # FIXME: racy, do a lock
18 my $name = $repo->wparam('name');
19 valid_user_name($name)
20 and Git::RepoCGI::User::does_exist($name)
21 and $repo->err("User with that name already exists.");
23 my $user = Git::RepoCGI::User->ghost($name);
24 if ($user->cgi_fill($repo)) {
25 $user->conjure;
26 print <<EOT;
27 <p>User $name successfuly registered.</p>
28 <p>
29 You can now <a href="regproj.cgi?mode=push">start a hosted project</a>
30 and <a href="regproj.cgi?mode=fork">create forks</a>. To use them, you
31 need to <a href="editproj.cgi">grant push access</a> to yourself,
32 using the project's adminstration password.
33 </p>
34 <p>
35 Of course, other administrators can give you access to an existing
36 project, but why share their project when <em>you can have your own
37 fork</em>? You can have push access to many projects, and little
38 additional resources will be used by creating new forks.
39 </p>
40 <p>Congratulations! Now, get forking!</p>
41 EOT
42 exit;
46 my $name = $repo->wparam('name');
47 my $email = $repo->sparam('email');
48 my $keys = $repo->sparam('keys');
49 print <<EOT;
50 <p>
51 This page allows you to register as a user of this service.
52 You must register as a user in order to be granted push access
53 to depot mode projects that you create.
54 </p>
56 <h2>User Acount Access</h2>
57 <p>
58 SSH is used for pushing (the <tt>git+ssh</tt> protocol), and the
59 SSH key that you provide in this form will be used to authenticate you.
60 There is no password; however, we recommend that your private SSH key
61 be password-protected; use <code>ssh-agent</code> to help your fingers.
62 </p>
63 You can find your public key in <tt>~/.ssh/id_rsa.pub</tt> or
64 <tt>~/.ssh/id_dsa.pub</tt>. If you do not have one yet, you can
65 generate it using the <code>ssh-keygen</code> command.
66 </p>
67 <p>
68 You can paste multiple keys in the box below, each on a separate line.
69 Paste each key <em>including</tt> the <tt>ssh-</tt>whatever prefix and
70 email-like postfix.
71 </p>
73 <h2>E-mail Address</h2>
74 <p>
75 We do not share your email contact, but this address may be used to
76 contact you or confirm your identity shall the need arise. We also
77 need to send you an e-mail if you want to update your SSH keys later.
78 </p>
80 <h2>Terms of Use</h2>
81 <p>
82 By submitting this form, you are confirming that you will push only free
83 software and no content that would violate any law of Czech Republic.
84 You also agree to the <a href=/about.html">terms for using the site</a>.
85 </p>
86 <p>
87 Have fun!
88 </p>
90 <h3>Register Account</h3>
91 <form method="post">
92 <p>Login: <input type="text" name="name" value="$name" /></p>
93 <p>Email: <input type="text" name="email" value="$email" /></p>
94 <p>Public SSH key(s): <br />
95 <textarea name="keys" rows="5" cols="80">$keys</textarea></p>
96 <p style="display:none">Anti-captcha (leave empty!): <input type="text" name="mail" /></p>
97 <p><input type="submit" name="y0" value="Register" /></p>
98 </form>
99 EOT