From: Vladimir Panteleev
Date: Mon, 15 Mar 2021 14:46:23 +0000 (+0000)
Subject: Resurrect createaccount.cgi (#68)
X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=390c097856fc7525a1d160ed252b5ac848665822;p=thirdparty%2Fbugzilla.git
Resurrect createaccount.cgi (#68)
* Move the new sign-up mini-form to a template
* Resurrect createaccount.cgi
Many places in Bugzilla still link to createaccount.cgi. It is
probably worthwhile to still have a stand-alone sign-up page.
Simply reuse the mini-form to enable doing so using the new sign-up
flow.
* Make "Sign Up" link to createaccount.cgi
This fixes:
1. middle-clicking to open the form in a new tab
2. signing up without having to enable JavaScript
3. consistency with the "Log In" link, which already does something similar.
---
diff --git a/createaccount.cgi b/createaccount.cgi
new file mode 100644
index 000000000..f0fd40730
--- /dev/null
+++ b/createaccount.cgi
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+use 5.10.1;
+use strict;
+use warnings;
+
+use lib qw(. lib local/lib/perl5);
+
+use Bugzilla;
+use Bugzilla::Constants;
+use Bugzilla::Error;
+use Bugzilla::Token;
+
+# Just in case someone already has an account, let them get the correct footer
+# on an error message. The user is logged out just after the account is
+# actually created.
+my $user = Bugzilla->login(LOGIN_OPTIONAL);
+my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {doc_section => 'myaccount.html'};
+
+print $cgi->header();
+
+$user->check_account_creation_enabled;
+my $login = $cgi->param('login');
+
+if (defined($login)) {
+
+ # Check the hash token to make sure this user actually submitted
+ # the create account form.
+ my $token = $cgi->param('token');
+ check_hash_token($token, ['create_account']);
+
+ $user->check_and_send_account_creation_confirmation($login);
+ $vars->{'login'} = $login;
+
+ $template->process("account/created.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
+ exit;
+}
+
+# Show the standard "would you like to create an account?" form.
+$template->process("account/create.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
diff --git a/template/en/default/account/auth/signup-form.html.tmpl b/template/en/default/account/auth/signup-form.html.tmpl
new file mode 100644
index 000000000..591eae564
--- /dev/null
+++ b/template/en/default/account/auth/signup-form.html.tmpl
@@ -0,0 +1,42 @@
+[%# The contents of this file are subject to the Mozilla Public
+ # License Version 1.1 (the "License"); you may not use this file
+ # except in compliance with the License. You may obtain a copy of
+ # the License at http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS
+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ # implied. See the License for the specific language governing
+ # rights and limitations under the License.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Netscape Communications
+ # Corporation. Portions created by Netscape are
+ # Copyright (C) 1998 Netscape Communications Corporation. All
+ # Rights Reserved.
+ #
+ # Contributor(s): Jacob Steenhagen
+ #%]
+
+
diff --git a/template/en/default/account/auth/signup-small.html.tmpl b/template/en/default/account/auth/signup-small.html.tmpl
index fba1cc191..ed5dfd4cb 100644
--- a/template/en/default/account/auth/signup-small.html.tmpl
+++ b/template/en/default/account/auth/signup-small.html.tmpl
@@ -24,33 +24,12 @@
# then we are accessing the home page. %]
- Sign Up
diff --git a/template/en/default/account/create.html.tmpl b/template/en/default/account/create.html.tmpl
index 93299f682..5ce75fab8 100644
--- a/template/en/default/account/create.html.tmpl
+++ b/template/en/default/account/create.html.tmpl
@@ -60,23 +60,7 @@
[% END %]
-
+[% PROCESS "account/auth/signup-form.html.tmpl" %]
[% Hook.process('additional_methods') %]