CGI: ssh key wrap=off
[girocco.git] / cgi / reguser.cgi
blob5bf67e1ebf901cc863d7be12c910a1cb9668020c
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.</p>
50 <p>We won't bother to verify your email contact,
51 but fill in something sensible in your own interest
52 so that we can contact you or confirm your identity shall the need arise. We also need to send you an e-mail if you want to update your SSH keys later.</p>
53 <p>By submitting this form, you are confirming that you will push only free software
54 and no content that would violate any law of Czech Republic. Have fun!</p>
55 <form method="post">
56 <p>Login: <input type="text" name="name" /></p>
57 <p>Email: <input type="text" name="email" /></p>
58 <p>Public SSH key(s): <textarea wrap="off" name="keys" rows="5" cols="80"></textarea></p>
59 <p style="display:none">Anti-captcha (leave empty!): <input type="text" name="mail" /></p>
60 <p><input type="submit" name="y0" value="Register" /></p>
61 </form>
62 EOT