about.html: Better UPC sponsorship link
[girocco/ztw.git] / cgi / reguser.cgi
blobe6490667ed118a2bdf01fc8451d76838c4b938d4
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');
12 my $cgi = $repo->cgi;
14 if ($cgi->param('mail')) {
15 print "<p>Go away, bot.</p>";
16 exit;
19 if ($cgi->param('name')) {
20 # submitted, let's see
21 # FIXME: racy, do a lock
22 my $name = $repo->wparam('name');
23 valid_user_name($name)
24 and Git::RepoCGI::User::does_exist($name)
25 and $repo->err("User with that name already exists.");
27 my $user = Git::RepoCGI::User->ghost($name);
28 if ($user->cgi_fill($repo)) {
29 $user->conjure;
30 print <<EOT;
31 <p>User $name successfuly registered.</p>
32 <p>Project administrators can now <a href="editproj.cgi">assign you</a> to have a push access to their projects
33 (use project name as username, admin password as password).
34 (One user can have push access to multiple projects and multiple users can have push access to one project.)
35 </p>
36 <p>Congratulations!</p>
37 EOT
38 exit;
42 print <<EOT;
43 <p>Here you can register a user.
44 You need to register a user so that it can be granted project(s) push access.</p>
45 <p>SSH is used for pushing (the <tt>git+ssh</tt> protocol), your SSH key authenticates you -
46 there is no password (though we recommend that your SSH key is password-protected; use <code>ssh-agent</code> to help your fingers).
47 You can find your public key in <tt>~/.ssh/id_rsa.pub</tt> or <tt>~/.ssh/id_dsa.pub</tt>.
48 If you do not have any yet, generate it using the <code>ssh-keygen</code> command.
49 You can paste multiple keys in the box below, each on a separate line. Paste each key <em>including</tt> the <tt>ssh-</tt>whatever prefix and email-like postfix.
50 Changing the keys later is not implemented yet - if you need to do that, please contact the administrator.</p>
51 <p>We won't bother to verify your email contact,
52 but fill in something sensible in your own interest
53 so that we can contact you or confirm your identity shall the need arise.</p>
54 <p>By submitting this form, you are confirming that you will push only free software
55 and no content that would violate any law of Czech Republic. Have fun!</p>
56 <form method="post">
57 <p>Login: <input type="text" name="name" /></p>
58 <p>Email: <input type="text" name="email" /></p>
59 <p>Public SSH key(s): <textarea name="keys" rows="5" cols="80"></textarea></p>
60 <p style="display:none">Anti-captcha (leave empty!): <input type="text" name="mail" /></p>
61 <p><input type="submit" name="y0" value="Register" /></p>
62 </form>
63 EOT