FINAL suepr merge step : added all modules to this super repos
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
User Registration Password 7.x-1.3 2012-09-12
|
||||
---------------------------------------------
|
||||
- Feature request: Translatable Confirmation E-Mail - By kle - http://drupal.org/node/1321998
|
||||
- New: The correct configuration options are set from the 1.3 release and higher during install. No need to configure anything from now on.
|
||||
- New: The default 'Account activation' e-mail template will be overridden during installation, now it makes a lot more sense.
|
||||
- Renamed the user_registrationpassword variable to user_registrationpassword_registration, so we can actually remove it correctly via the uninstaller.
|
||||
- Minor edit to the e-mail template.
|
||||
- Small change in the logic, we used to check for the role of a user (if admin perms) before we called the submit handler, we now only check if the uid < 1. This fixes a minor possible issue. This module should only work if an anonymous user tries to register. This also made #1773430 unnecessary.
|
||||
- Added an update function to update the variable names that changed.
|
||||
- Added CHANGELOG.txt so people can check at all times what changed, even if d.o. is down. (for maintenance for example)
|
||||
- Updated README.txt to reflect changes and remove wrong / unclear documentation.
|
||||
|
||||
User Registration Password 1.2 2012-04-12
|
||||
-----------------------------------------
|
||||
- Bug by scor : Error with user status value - http://drupal.org/node/1513016
|
||||
- New: hook_mailkeys() is now supported, please test this. Thanks ominds for the patch!
|
||||
|
||||
User Registration Password 1.1 2012-02-04
|
||||
-----------------------------------------
|
||||
- Bug by jide : Verification email was sent even when option was disabled.
|
||||
|
||||
User Registration Password 1.0 2012-02-04
|
||||
-----------------------------------------
|
||||
- First commit.
|
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
@@ -0,0 +1,177 @@
|
||||
|
||||
CONTENTS OF THIS FILE
|
||||
---------------------
|
||||
|
||||
* Introduction
|
||||
* Installation
|
||||
* Configuration
|
||||
* E-mail templates
|
||||
* Multilangual sites
|
||||
* Known issues
|
||||
* De-installation
|
||||
* Upgrade notes
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
------------
|
||||
|
||||
User Registration Password let's users register with a password
|
||||
on the registration form when 'Require e-mail verification when
|
||||
a visitor creates an account' is enabled on the configuration page.
|
||||
|
||||
By default, users can create accounts directly on the registration form, set
|
||||
their password and be immediately logged in, or they can create their account,
|
||||
wait for a verification e-mail, and then create their password.
|
||||
|
||||
With this module, users are able to create their account along with their
|
||||
password and simply activate their account when receiving the verification
|
||||
e-mail by clicking on the activation link provided via this e-mail.
|
||||
|
||||
User Registration Password transforms the checkbox on the
|
||||
admin/config/people/accounts page into a radio list with 3 options.
|
||||
|
||||
The first 2 are default Drupal behaviour:
|
||||
0 Do not require a verification e-mail, and let users set their password on the registration form.
|
||||
0 Require a verification e-mail, but wait for the approval e-mail to let users set their password.
|
||||
|
||||
The newly added option is:
|
||||
X Require a verification e-mail, but let users set their password directly on the registration form.
|
||||
|
||||
The first 2 disable User Registration Password, only the 3rd option activates
|
||||
the behaviour offered by this module.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
|
||||
Installation is like any other module, just place the files in the
|
||||
sites/all/modules directory and enable the module on the modules page.
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
-------------
|
||||
|
||||
From the 7.x-1.3 release and higher the module sets the correct
|
||||
configuration settings on install, including the correct account
|
||||
activation e-mail template. But if you want to change something, these
|
||||
steps describe how to configure the module in more detail.
|
||||
|
||||
On the admin/config/people/accounts page make sure you have selected:
|
||||
|
||||
Who can register accounts?
|
||||
0 Administrators only
|
||||
X Visitors
|
||||
0 Visitors, but administrator approval is required
|
||||
|
||||
Then select 'Require a verification e-mail, but let users set their password directly on the registration form.' at:
|
||||
|
||||
Require e-mail verification when a visitor creates an account
|
||||
0 Do not require a verification e-mail, and let users set their password on the registration form.
|
||||
0 Require a verification e-mail, but wait for the approval e-mail to let users set their password.
|
||||
X Require a verification e-mail, but let users set their password directly on the registration form.
|
||||
|
||||
The module is now configured and ready for use. This is also the only way to
|
||||
configure it correctly. This module will also not work if you do not have
|
||||
'Visitors' selected at 'Who can register accounts?' on the same page.
|
||||
|
||||
|
||||
E-MAIL TEMPLATES
|
||||
----------------
|
||||
|
||||
Regarding e-mail templates:
|
||||
|
||||
You do not have to alter any e-mail templates, User Registration Password
|
||||
overrides the default 'Account activation' e-mail template from version
|
||||
7.x-1.3 and from 6.x-1.0 (and higher) during installation. So there is no
|
||||
need to change anything anymore on a fresh installation.
|
||||
|
||||
If you have previously modified the account activation e-mail template
|
||||
before you installed this module and discovered that it overrides the
|
||||
default Account activation e-mail template, no worries! The installer saves
|
||||
your changes to the template to a temporally variable and revives them when
|
||||
you disable AND uninstall User Registration Password. Your modifications are
|
||||
revived and you can now copy paste them to a text file and re-install
|
||||
User Registration Password again and make the changes to the 'account
|
||||
activation' e-mail template based on your previous version.
|
||||
|
||||
|
||||
MULTILANGUAL SITES
|
||||
------------------
|
||||
|
||||
For multilangual sites: i18n / variables are supported for the e-mail template.
|
||||
Be sure to enable them at the admin/config/regional/i18n/variable page and to
|
||||
translate them via the admin/config/regional/translate page.
|
||||
|
||||
Ones configured correctly, users will receive an e-mail in their default
|
||||
language, setting available on user's edit page. It does not matter what the
|
||||
site language is, this setting will be leading and supercede the site's default
|
||||
language. So it is logical and corrent that if you have an German based site
|
||||
with, let's say German and English languages enabled, and German is also the
|
||||
site's default language, still when users have English as their default browser
|
||||
language, they will receive an English e-mail.
|
||||
|
||||
|
||||
KNOWN ISSUES
|
||||
------------
|
||||
|
||||
None yet that we didn't solve.
|
||||
|
||||
If you run into problems, like access denied or other (possibly) cache-related
|
||||
issues, or if you have enabled the module via drush, remember to clear
|
||||
the site cache via the admin/config/development/performance page.
|
||||
|
||||
If this does not help, first try on IRC if anyone can help you, if you still
|
||||
are not able to get it to work, open a new issue with a descent title and
|
||||
description of the problem here:
|
||||
http://drupal.org/node/add/project-issue/user_registrationpassword
|
||||
|
||||
|
||||
DE-INSTALLATION
|
||||
---------------
|
||||
|
||||
If you want to disable the module temporally, just select the first or second
|
||||
option on the the admin/config/people/accounts page at:
|
||||
|
||||
Require e-mail verification when a visitor creates an account
|
||||
1 Do not require a verification e-mail, and let users set their password on the registration form.
|
||||
2 Require a verification e-mail, but wait for the approval e-mail to let users set their password.
|
||||
3 Require a verification e-mail, but let users set their password directly on the registration form.
|
||||
|
||||
This disables the User Registration Password functionality without
|
||||
disabling / uninstalling it.
|
||||
|
||||
If you want to remove the module, just disable and uninstall it as you do
|
||||
for any other module via the admin/modules page.
|
||||
|
||||
|
||||
UPGRADE NOTES
|
||||
-------------
|
||||
|
||||
In earlier versions, this module did not override the default 'Account
|
||||
activation' e-mail template. To prevent questions and keep in line with the
|
||||
level of information we would like to offer with this module, we provide the
|
||||
default e-mail template this module will use to override the 'Account
|
||||
activation' e-mail template. When you update from 1.0/1.1/1.2 to 1.3, this
|
||||
template is not activated when you run the updater. You have to change this
|
||||
manually, just like before version 1.3, so most of you already know this.
|
||||
From versions 6.x-1.0 and 7.x-1.3 and up, the installer overrides the default
|
||||
'Account activation' e-mail template, so we only list it here as extra information.
|
||||
|
||||
Modified 'Account activation' e-mail template for User Registration password:
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
[user:name],
|
||||
|
||||
Your account at [site:name] has been activated.
|
||||
|
||||
You will be able to log in to [site:login-url] in the future using:
|
||||
|
||||
username: [user:name]
|
||||
password: your password.
|
||||
|
||||
-- [site:name] team
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
You can edit the 'Account activation' e-mail template at the
|
||||
admin/config/people/accounts page.
|
@@ -0,0 +1,15 @@
|
||||
name = User registration password
|
||||
description = Let users register with a password on the registration form when verification mail is required.
|
||||
package = Authentication
|
||||
configure = admin/config/people/accounts
|
||||
files[] = user_registrationpassword.module
|
||||
files[] = user_registrationpassword.pages.inc
|
||||
core = 7.x
|
||||
dependencies[] = user
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-09-13
|
||||
version = "7.x-1.3"
|
||||
core = "7.x"
|
||||
project = "user_registrationpassword"
|
||||
datestamp = "1347498309"
|
||||
|
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Uninstall function to clean up variables data.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
function user_registrationpassword_install() {
|
||||
$t = get_t();
|
||||
// Set the correct default configuration settings
|
||||
// so the module needs no more configuration.
|
||||
// Enable account registration without e-mail confirmation.
|
||||
variable_set('user_register', 1);
|
||||
// Disable e-mail verification.
|
||||
variable_set('user_email_verification', 0);
|
||||
// Prevent standard notification email to administrators and to user.
|
||||
variable_set('user_mail_register_pending_approval_notify', 0);
|
||||
// Save the original activation email template to a temporally
|
||||
// variable, so we can revive them when we uninstall the module.
|
||||
variable_set('user_registrationpassword_user_mail_status_activated_subject_original', variable_get('user_mail_status_activated_subject', ''));
|
||||
variable_set('user_registrationpassword_user_mail_status_activated_body_original', variable_get('user_mail_status_activated_body', ''));
|
||||
// Set basic e-mail template variable for the
|
||||
// account activation e-mail so it makes sense.
|
||||
variable_set('user_mail_status_activated_subject', $t('Account details for [user:name] at [site:name]'));
|
||||
variable_set('user_mail_status_activated_body', $t('[user:name],
|
||||
|
||||
Your account at [site:name] has been activated.
|
||||
|
||||
You will be able to log in to [site:login-url] in the future using:
|
||||
|
||||
username: [user:name]
|
||||
password: your password.
|
||||
|
||||
-- [site:name] team'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function user_registrationpassword_uninstall() {
|
||||
// Reset system variables back to defauls.
|
||||
variable_del('user_mail_register_pending_approval_notify');
|
||||
// Reset the original (or previous adapted) ativation email template.
|
||||
variable_set('user_mail_status_activated_subject', variable_get('user_registrationpassword_user_mail_status_activated_subject_original', ''));
|
||||
variable_set('user_mail_status_activated_body', variable_get('user_registrationpassword_user_mail_status_activated_body_original', ''));
|
||||
// Delete all variables related to user_registrationpassword.
|
||||
db_delete('variable')
|
||||
->condition('name', db_like('user_registrationpassword_') . '%', 'LIKE')
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update 7000 updates the name of the variable.
|
||||
*/
|
||||
function user_registrationpassword_update_7000() {
|
||||
// Copy the value of the user_registrationpassword variable
|
||||
// to the user_registrationpassword_registration variable.
|
||||
variable_set('user_registrationpassword_registration', variable_get('user_registrationpassword', 2));
|
||||
// Delete the user_registrationpassword variable.
|
||||
variable_del('user_registrationpassword');
|
||||
}
|
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Enables password creation on registration form.
|
||||
*/
|
||||
|
||||
/**
|
||||
* No verification email is sent.
|
||||
*/
|
||||
define('USER_REGISTRATIONPASS_NO_VERIFICATION', 0);
|
||||
|
||||
/**
|
||||
* Verification email is sent before password is set.
|
||||
*/
|
||||
define('USER_REGISTRATIONPASS_VERIFICATION_DEFAULT', 1);
|
||||
|
||||
/**
|
||||
* Verification email is sent after password is set.
|
||||
*/
|
||||
define('USER_REGISTRATIONPASS_VERIFICATION_PASS', 2);
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function user_registrationpassword_menu() {
|
||||
$items['user/registrationpassword/%/%/%'] = array(
|
||||
'title' => 'Confirm account',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('user_registrationpassword_confirm_account', 2, 3, 4),
|
||||
'access callback' => TRUE,
|
||||
'type' => MENU_CALLBACK,
|
||||
'file' => 'user_registrationpassword.pages.inc',
|
||||
);
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter() for the user administration form.
|
||||
*/
|
||||
function user_registrationpassword_form_user_admin_settings_alter(&$form, &$form_state) {
|
||||
$form['registration_cancellation']['user_registrationpassword_registration'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Require e-mail verification when a visitor creates an account'),
|
||||
'#description' => t('Choose whether new users will be required to validate their e-mail address prior to logging into the site, and will be assigned a system-generated password, or if they can set their password directly on the registration form. With this setting disabled, users will be logged in immediately upon registering, and may select their own passwords during registration.'),
|
||||
'#weight' => 0,
|
||||
'#options' => array(
|
||||
USER_REGISTRATIONPASS_NO_VERIFICATION => t('Do not require a verification e-mail, and let users set their password on the registration form.'),
|
||||
USER_REGISTRATIONPASS_VERIFICATION_DEFAULT => t('Require a verification e-mail, but wait for the approval e-mail to let users set their password.'),
|
||||
USER_REGISTRATIONPASS_VERIFICATION_PASS => t('Require a verification e-mail, but let users set their password directly on the registration form.'),
|
||||
),
|
||||
'#default_value' => variable_get('user_registrationpassword_registration', USER_REGISTRATIONPASS_VERIFICATION_PASS),
|
||||
);
|
||||
|
||||
$form['registration_cancellation']['user_email_verification']['#access'] = FALSE;
|
||||
$email_token_help = t('Available variables are: [site:name], [site:url], [user:name], [user:mail], [site:login-url], [site:url-brief], [user:edit-url], [user:one-time-login-url], [user:cancel-url].');
|
||||
|
||||
$form['email_user_registrationpassword'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Welcome (no approval required, password is set)'),
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
'#description' => t('Edit the welcome e-mail messages sent to new members upon registering, when no administrator approval is required and password has already been set.') . ' ' . $email_token_help,
|
||||
'#group' => 'email',
|
||||
);
|
||||
$form['email_user_registrationpassword']['user_registrationpassword_register_subject'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Subject'),
|
||||
'#default_value' => _user_registrationpassword_mail_text('register_subject', NULL, array(), FALSE),
|
||||
'#maxlength' => 180,
|
||||
);
|
||||
$form['email_user_registrationpassword']['user_registrationpassword_register_body'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Body'),
|
||||
'#default_value' => _user_registrationpassword_mail_text('register_body', NULL, array(), FALSE),
|
||||
'#rows' => 15,
|
||||
);
|
||||
// Overwrite the default activation e-mail template with our own.
|
||||
$form['email_activated']['settings']['user_mail_status_activated_subject'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Subject'),
|
||||
'#default_value' => variable_get('user_mail_status_activated_subject', _user_registrationpassword_mail_text('status_activated_subject', NULL, array(), FALSE)),
|
||||
'#maxlength' => 180,
|
||||
);
|
||||
$form['email_activated']['settings']['user_mail_status_activated_body'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Body'),
|
||||
'#default_value' => variable_get('user_mail_status_activated_body', _user_registrationpassword_mail_text('status_activated_body', NULL, array(), FALSE)),
|
||||
'#rows' => 15,
|
||||
);
|
||||
|
||||
$form['#submit'][] = 'user_registrationpassword_admin_settings_submit';
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for the user admin form.
|
||||
*/
|
||||
function user_registrationpassword_admin_settings_submit(&$form, &$form_state) {
|
||||
$value = $form_state['values']['user_registrationpassword_registration'];
|
||||
if ($value == USER_REGISTRATIONPASS_VERIFICATION_PASS) {
|
||||
variable_set('user_email_verification', 0);
|
||||
// Prevent standard notification email to administrators and to user.
|
||||
variable_set('user_mail_register_pending_approval_notify', 0);
|
||||
}
|
||||
else {
|
||||
variable_set('user_email_verification', (int) $value);
|
||||
// Let default value.
|
||||
// @see _user_mail_notify()
|
||||
variable_del('user_mail_register_pending_approval_notify');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter() for the user registration form.
|
||||
*/
|
||||
function user_registrationpassword_form_user_register_form_alter(&$form, &$form_state) {
|
||||
// Prevent this from being run if approval with password on registration
|
||||
// form is set and the user is an anonymous user registering to the site.
|
||||
// When admin users create a user, this does not need to be executed.
|
||||
// And when this also does not need to be executed 'user_register' is not set as
|
||||
// 'Visitors can create accounts and no administrator approval is required.'
|
||||
// (user registers, recieves user_registrationpass email, would not make sense.)
|
||||
// (cause that will unblock the user Without the admin 'approving'.)
|
||||
global $user;
|
||||
if (variable_get('user_register', 0) == 1 && variable_get('user_registrationpassword_registration', USER_REGISTRATIONPASS_VERIFICATION_PASS) == USER_REGISTRATIONPASS_VERIFICATION_PASS && $user->uid < 1) {
|
||||
$form['account']['status']['#default_value'] = 0;
|
||||
$form['account']['notify']['#default_value'] = 0;
|
||||
$form['#submit'][] = 'user_registrationpassword_form_user_register_submit';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for the user registration form.
|
||||
*/
|
||||
function user_registrationpassword_form_user_register_submit(&$form, &$form_state) {
|
||||
// Remove the message sent by default.
|
||||
$message = t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.<br />In the meantime, a welcome message with further instructions has been sent to your e-mail address.');
|
||||
$position = array_search($message, $_SESSION['messages']['status']);
|
||||
if ($position !== FALSE) {
|
||||
unset($_SESSION['messages']['status'][$position]);
|
||||
}
|
||||
$_SESSION['messages']['status'] = array_values($_SESSION['messages']['status']);
|
||||
// Notify the user.
|
||||
$account = $form_state['user'];
|
||||
$params['account'] = $account;
|
||||
$mail = drupal_mail('user_registrationpassword', 'register', $account->mail, user_preferred_language($account), $params);
|
||||
|
||||
drupal_set_message(t('A welcome message with further instructions has been sent to your e-mail address.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_mail().
|
||||
*/
|
||||
function user_registrationpassword_mail($key, &$message, $params) {
|
||||
$language = $message['language'];
|
||||
$variables = array('user' => $params['account']);
|
||||
$message['subject'] .= _user_registrationpassword_mail_text($key . '_subject', $language, $variables);
|
||||
$message['body'][] = _user_registrationpassword_mail_text($key . '_body', $language, $variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mail string for a variable name.
|
||||
*
|
||||
* Used by user_registrationpassword_mail() and the settings forms to retrieve strings.
|
||||
*/
|
||||
function _user_registrationpassword_mail_text($key, $language = NULL, $variables = array(), $replace = TRUE) {
|
||||
$langcode = isset($language) ? $language->language : NULL;
|
||||
|
||||
if ($admin_setting = variable_get('user_registrationpassword_' . $key, FALSE)) {
|
||||
// An admin setting overrides the default string.
|
||||
$text = $admin_setting;
|
||||
}
|
||||
else {
|
||||
// No override, return default string.
|
||||
switch ($key) {
|
||||
case 'register_subject':
|
||||
$text = t('Account details for [user:name] at [site:name]', array(), array('langcode' => $langcode));
|
||||
break;
|
||||
case 'register_body':
|
||||
$text = t("[user:name],
|
||||
|
||||
Thank you for registering at [site:name]. You may now log in and verify your account by clicking this link or copying and pasting it to your browser:
|
||||
|
||||
[user:registrationpassword-url]
|
||||
|
||||
This link can only be used once. You will be able to log in at [site:login-url] in the future using:
|
||||
|
||||
username: [user:name]
|
||||
password: Your password
|
||||
|
||||
-- [site:name] team", array(), array('langcode' => $langcode));
|
||||
break;
|
||||
case 'status_activated_subject':
|
||||
$text = t('Account details for !username at !site', array(), array('langcode' => $langcode));
|
||||
break;
|
||||
case 'status_activated_body':
|
||||
$text = t("!username,
|
||||
|
||||
Your account at !site has been activated.
|
||||
|
||||
You will be able to log in to !login_uri in the future using:
|
||||
|
||||
username: !username
|
||||
password: your password.
|
||||
|
||||
-- !site team", array(), array('langcode' => $langcode));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($replace) {
|
||||
// We do not sanitize the token replacement, since the output of this
|
||||
// replacement is intended for an e-mail message, not a web browser.
|
||||
return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_registrationpassword_mail_tokens', 'sanitize' => FALSE));
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Token callback to add unsafe tokens for user mails.
|
||||
*
|
||||
* @see user_mail_tokens()
|
||||
* @see user_registrationpassword_mail()
|
||||
*/
|
||||
function user_registrationpassword_mail_tokens(&$replacements, $data, $options) {
|
||||
user_mail_tokens($replacements, $data, $options);
|
||||
if (isset($data['user'])) {
|
||||
$replacements['[user:registrationpassword-url]'] = user_registrationpassword_confirmation_url($data['user']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a unique URL for a user to login with their password already set.
|
||||
*
|
||||
* @param object $account
|
||||
* An object containing the user account.
|
||||
*
|
||||
* @return
|
||||
* A unique URL that provides a one-time log in for the user, from which
|
||||
* they can change their password.
|
||||
*/
|
||||
function user_registrationpassword_confirmation_url($account) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
return url("user/registrationpassword/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_mailkeys().
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function user_registrationpassword_mailkeys() {
|
||||
return array(
|
||||
'register' => t('Welcome message when user self-registers and sets password during registration'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_mail_edit_text().
|
||||
*
|
||||
* @param string $mailkey
|
||||
* @param object $language
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function user_registrationpassword_mail_edit_text($mailkey, $language) {
|
||||
$return = array();
|
||||
$return['subject'] = _user_registrationpassword_mail_text($mailkey . '_subject', $language, array(), FALSE);
|
||||
$return['body'] = _user_registrationpassword_mail_text($mailkey . '_body', $language, array(), FALSE);
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_mail_edit_token_types().
|
||||
*
|
||||
* @param string $mailkey
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function user_registrationpassword_mail_edit_token_types($mailkey) {
|
||||
return array('user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info().
|
||||
*
|
||||
* @see variable.module.
|
||||
*/
|
||||
function user_registrationpassword_variable_info($options) {
|
||||
$variables['user_registrationpassword_register_[mail_part]'] = array(
|
||||
'type' => 'user_mail',
|
||||
'title' => t('Welcome, no approval, password is already set', array(), $options),
|
||||
'description' => t('Customize welcome e-mail messages sent to new members when password is already set .', array(), $options),
|
||||
'group' => 'user_mails',
|
||||
);
|
||||
return $variables;
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* User page callback file for the user_registrationpassword module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Menu callback; process one time login link and redirects to the user page on success.
|
||||
*/
|
||||
function user_registrationpassword_confirm_account($form, &$form_state, $uid, $timestamp, $hashed_pass) {
|
||||
global $user;
|
||||
|
||||
// When processing the one-time login link, we have to make sure that a user
|
||||
// isn't already logged in.
|
||||
if ($user->uid) {
|
||||
// The existing user is already logged in.
|
||||
if ($user->uid == $uid) {
|
||||
drupal_set_message(t('You are logged in as %user. <a href="!user_edit">Change your password.</a>', array('%user' => $user->name, '!user_edit' => url("user/$user->uid/edit"))));
|
||||
}
|
||||
// A different user is already logged in on the computer.
|
||||
else {
|
||||
$reset_link_account = user_load($uid);
|
||||
if (!empty($reset_link_account)) {
|
||||
drupal_set_message(t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href="!logout">logout</a> and try using the link again.',
|
||||
array('%other_user' => $user->name, '%resetting_user' => $reset_link_account->name, '!logout' => url('user/logout'))));
|
||||
}
|
||||
else {
|
||||
// Invalid one-time link specifies an unknown user.
|
||||
drupal_set_message(t('The one-time login link you clicked is invalid.'));
|
||||
}
|
||||
}
|
||||
drupal_goto();
|
||||
}
|
||||
else {
|
||||
// Time out, in seconds, until login URL expires. 24 hours = 86400 seconds.
|
||||
$timeout = 86400;
|
||||
$current = REQUEST_TIME;
|
||||
// Some redundant checks for extra security ?
|
||||
$users = user_load_multiple(array($uid), array('status' => '0'));
|
||||
if ($timestamp <= $current && $account = reset($users)) {
|
||||
// No time out for first time login.
|
||||
if ($account->login && $current - $timestamp > $timeout) {
|
||||
drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
|
||||
drupal_goto('user/password');
|
||||
}
|
||||
elseif ($account->uid && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
|
||||
watchdog('user', 'User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp));
|
||||
// Activate the user.
|
||||
$account = user_save($account, array('status' => 1));
|
||||
// Set the new user.
|
||||
$user = $account;
|
||||
// user_login_finalize() also updates the login timestamp of the
|
||||
// user, which invalidates further use of the one-time login link.
|
||||
user_login_finalize();
|
||||
drupal_set_message(t('You have just used your one-time login link. Your account is now active.'));
|
||||
drupal_goto('user');
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'));
|
||||
drupal_goto('user/password');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Deny access, no more clues.
|
||||
// Everything will be in the watchdog's URL for the administrator to check.
|
||||
drupal_access_denied();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user