Ticket #236 (closed enhancement: fixed)

Opened 4 years ago

Last modified 2 years ago

Restrict registration of new users

Reported by: NilsLindenberg Owned by: NilsLindenberg
Priority: normal Milestone: 1.1.6.4
Component: actions Version: 1.1.6.2
Severity: normal Keywords: registration user usersettings 1.1.7-ported
Cc:

Description (last modified by BrianKoontz) (diff)

 UserRegistration has proven quite popular since there are environments where you only want some users to have access to the wiki, or where the admin wants to stop registration at all.

The code needs to be modifed in order to match changes to usersettings.php in the last versions.

Related tickets: #609

Change History

Changed 4 years ago by NilsLindenberg

  • status changed from new to closed
  • resolution set to fixed

Changed 4 years ago by DarTar

Nils, I tested your nice hack, here's a few comments:

  • I guess this is a debug check that should disappear from the final version, right?
  • I find that "register code" is not very speaking, maybe it should be "registration code" or (à la Google) "invitation code".
  • It would be nice if a user trying to register without a valid registration code obtained further instructions (e.g. a link to a feedback form to contact the admin?). Or maybe a configurable line saying "This is a private wiki, only invited members can register an account". As a user, I'd find quite frustrating seeing a registration form asking me to fill in a mysterious register code with no explanation whatsoever.
  • as for variable naming (including wikka.config.php settings) remember that - according to the coding guidelines - if the variable name consists of two distinct words they should be separated by an underscore, e.g. registration_code and not registrationcode or registercode.

Changed 4 years ago by NilsLindenberg

  • status changed from closed to reopened
  • resolution fixed deleted

Ok, I'll change it in the next days.

Changed 4 years ago by NilsLindenberg

  • status changed from reopened to closed
  • resolution set to fixed

points 1, 2 and 4 fixed + Explanation should be better now.

Changed 4 years ago by WazoO

  • status changed from closed to reopened
  • resolution fixed deleted

usersettings.php - copy from the CSV in use ..... where - 'allow_user_registration' => '0'

This line doesn't appear to be used; if (!defined('NO_REGISTRATION')) define('NO_REGISTRATION', "Registration on this wiki is not possible."); Although, there is a "print (hallo)" line elsewhere ???? (although the resulting "hallo" on displayed pages indicates that "hallo" should be 'set' to something or some actual text string needs to replace the "hallo" string ...)

does not appear to be used; if (!defined('LOGIN_HEADING')) define('LOGIN_HEADING', "===Login===");

//initialize variables $registercode_highlight = ;

// is user trying to log in or register? $register = $this->GetConfigValue('allow_user_registration'); if (isset($_POSTaction?) && ($_POSTaction? == 'login')) {

where wikka.config.php includes the lines;

'meta_description' => ,

/* two lines added for UserRegistration Mod allow_registration sets the mode: 0 - no registration possible 1 - registration "without limits" 2 - password required registercode takes the password */

'allow_registration' => '0', 'registercode' => 'PlaceHolder');

These lines don't seem to take the $register = '0' case into consideration; still displaying the "Login/Registration" string instead of just the "Login" string ...

<td colspan="2"><?php echo ($register == '1' $register == '2') ? $this->Format(LOGIN_REGISTER_HEADING) : $this->Format(LOGIN_HEADING); ?></td>

wikka.php // default configuration values $wakkaDefaultConfig = array( .... // 'require_edit_note' => '0', # edit note optional (0, default), edit note required (1) edit note disabled (2)

'anony_delete_own_comments' => '1', 'public_sysinfo' => '0', # enable or disable public display of system information in SysInfo

// modified per http://wush.net/trac/wikka/changeset/130 for "allow user registration' ..

'require_edit_note' => '0', # edit note optional (0, default), edit note required (1) edit note disabled (2) 'allow_user_registration' => '1', # user registration disabled (0), enabled (1) or only possible with register code (2) 'registercode' => , # used by 'allow_user_registration' => '2'

// end of mod - 18 Jun 2006

Although this section is labelled "default section" and the "load configuration" routine comes next .... even going to the extent of shutting down the Apache server and restarting did not pull in the "config.php" settings .... I had to physically change the above lines to read;

// 'require_edit_note' => '0', # edit note optional (0, default), edit note required (1) edit note disabled (2)

'anony_delete_own_comments' => '1', 'public_sysinfo' => '0', # enable or disable public display of system information in SysInfo

// modified per http://wush.net/trac/wikka/changeset/130 for "allow user registration' ..

'require_edit_note' => '0', # edit note optional (0, default), edit note required (1) edit note disabled (2) 'allow_user_registration' => '0', # user registration disabled (0), enabled (1) or only possible with register code (2) 'registercode' => 'PlaceHolder', # used by 'allow_user_registration' => '2'

// end of mod - 18 Jun 2006

Then and only then did the "registration" lunes disappear from the usersettings page. However, as noted above, the navigation string still said "Login/Register" ...?????

///////// changed wikka.php line ; 'allow_user_registration' => '2', # user registration disabled (0), enabled (1) or only possible with register code (2)

seems to work just fine, ignoring that the data in the wikka.config.php does not actually seem to get read/used for this bit of code.

Does it simply boil down to that I can't find where "GetConfigValue" is ever actually defined?

Changed 4 years ago by DarTar

(bump) Nils?

Changed 4 years ago by NilsLindenberg

Nils is still occupied :( Wazoo, did you try out the latest version of usersettings.php? I'll take a closer look at it in the mid of next week.

Changed 4 years ago by WazoO

http://wush.net/trac/wikka/ticket/236

Yes (at the time - 8/15/2006 ... I don't see a date in the headers, and the SVN thing of "1 month ago" doesn't really place things in time) .... I started editing my copy .. managed to generate a white page .. gave up trying to find my screw-up, grabbed the "latest" version and moved that into my install ... only added my TrackingIPAddress code to that version ....

I surely don't mean to bore you with the details, but for example .... my seach mechanism for where the variable/function gets defined .....

../../actions$ grep GetConfigValue *.php contact.php:$email = $this->GetConfigValue("admin_email"); feedback.php: $recipient = $this->GetConfigValue("admin_email"); feedback.php: $subject = "Feedback from ".$this->GetConfigValue("wakka_name"); ..... OK, just now realized the one step not taken .... forgetting that the wikka.php I did grep is no longer the 'main' wikka.php file ... OK, rule out the 'not-defined' issue ...

That leaves me totally in the dark right now .... will get back to troubleshooting .. eventually ...

Just to make it clear, it's the setting of 'allow_registration' => '0' that is the major issue for the displayed pages .. secondary issue is why the config file doesn't seem to be read ...

Changed 4 years ago by WazoO

gads .. why do so many things go wrong with the formatting in here????

Changed 4 years ago by WazoO

OK .... here we go ....

 http://wikkawiki.org/UserRegistration says; Additions to the config additions to wikkaconfig.php

%%(php) 'allow_registration' => '2', 'registercode' => 'helloWorld', %%

However, the code asks for;

%%(php)

$register = $this->GetConfigValue('allow_user_registration');

%%

Changed 4 years ago by DarTar

  • status changed from reopened to closed
  • resolution set to fixed

WazoO,

why do so many things go wrong with the formatting in here????

This is Trac :) and its formatting rules are here: WikiFormatting

Just to make it clear, it's the setting of 'allow_registration' => '0' that is the major issue for the displayed pages .. secondary issue is why the config file doesn't seem to be read ...

I've doublechecked the dev version: the config setting is correctly defined everywhere as allow_user_registration - I've checked in actions, core, installer/upgrader. So I don't know where you get this error from, unless you are mixing the dev code with the very first (and obsolete) draft posted at  http://wikkawiki.org/UserRegistration. If you want to use code from SVN you should stick to this and avoid looking at former drafts posted on the Wikka website.

Hope this helps. I'm closing this ticket as everything works fine for me. Feel free to reopen it if the issue is not solved.

Changed 4 years ago by WazoO

  • status changed from closed to reopened
  • resolution fixed deleted

I'm still stuck with 'allow_user_registration' => '0' is still not fully utilized. Was a number of hours ago, but for sure ... while changing/saving the config file via one computer ... not logged into the Wikka on another system .. changing the code bit and then refreshing the screen on the second system .. I'll repeat that the "Login/Register" line does not change .... have not had time to re-look at the code, but .... maybe in a bit ...

Geeze, looking at my scratch pad notes in a previous post, the mismatch between the code and the config file seems so obvious now .... and based on that, it looks like I need to start with the $register variable .... ....

Changed 4 years ago by Wazoo

Data not used anywhere:

if (!defined('NO_REGISTRATION')) define('NO_REGISTRATION', "Registration on this wiki is not possible.");

2 instances of BEGIN/END *** Register *** ... believe one set was to have been changed to *** Registration ***

Line 502 not catching/using the config value setting:

<td colspan="2"><?php echo ($register == '1' $register == '2') ? $this->Format(LOGIN_REGISTER_HEADING) : $this->Format(LOGIN_HEADING); ?></td>

The actual click-on-the-link does bring up the appropriate screen ....

PHP 4.3.8 currently in use (upgrade on the way) if that makes any difference on the above compare / decision ....

Changed 4 years ago by NilsLindenberg

Wazoo, I am looking into this.

Changed 4 years ago by NilsLindenberg

Data not used anywhere: if (!defined('NO_REGISTRATION')) define('NO_REGISTRATION', "Registration on this wiki >is not possible.");

Yes, that is true. But when we separate the usersettings into different actions, {{register}} will need an info text if the registry is disabled so I decided not to remove it now.

2 instances of BEGIN/END *** Register *** ... believe one set was to have been changed >to *** Registration ***

if you speak about the comments, they are just there to make it easier to split up usersettings. Not all of the file is marked up this way

Line 502 not catching/using the config value setting:

actually line 533 is not needed, since $registered is already defined at 361.

Changed 4 years ago by Wazoo

Good catch on line 533

but the 'complaint' seems to center on (my) line 502 ... not seeing/using the case of ($register == '0') .... dorim what I checked, the routine works, it's just the 'displayed' value that doesn't seem to get rendered properly for "no registrations allowed" ... the 'alternate' Heading is not selected ...

<td colspan="2"><?php echo ($register == '1' $register == '2') ? $this->Format(LOGIN_REGISTER_HEADING) : $this->Format(LOGIN_HEADING); ?></td>

Changed 3 years ago by raffa

it would be nice to include the invitation functionality into 1.1.6.4, is the code ready to use?

Changed 3 years ago by BrianKoontz

  • milestone changed from 1.1.7 to 1.1.6.4

Milestone changed to 1.1.6.4 (see  http://wikkawiki.org/Wikka1164Development).

Changed 3 years ago by BrianKoontz

  • description modified (diff)

Changed 3 years ago by BrianKoontz

I would recommend moving the invitation code to the UR framework as outlined in #609. Doing this would help Wikka keep true to the principles of a "lightweight" core.

In fact, I've written a UR module to implement this functionality, so at some point a decision needs to be made as to which functionality to adopt.

Changed 3 years ago by BrianKoontz

(In [865]) Config param 'allow_user_registration' (option 1 only -- permit or deny registration) ported from 1.1.7. Refs #236

Changed 3 years ago by BrianKoontz

(In [866]) Added installation test for config param. Refs #236

Changed 3 years ago by BrianKoontz

(In [867]) Include 'allow_user_registration' in new 1.1.6.4 install. Refs #236

Changed 3 years ago by BrianKoontz

  • status changed from reopened to closed
  • resolution set to fixed

Tests successful using revision 867. With this ticket, there are now two methods available for restricting user logins: Via the 'allow_user_registration' config param that is currently in trunk or the new modular UR mechanism that is part of 1.1.6.4 and described in #609. At some point, a decision needs to be made which one we want to go with. For now, the functionality offered by Nils' mods are available in 1.1.6.4, so I'm duplicating this ticket (#628) for later discussion.

Changed 2 years ago by DarTar

  • keywords 1.1.7-ported added
Note: See TracTickets for help on using tickets.