Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Password Reset

vanoobvanoob New
edited October 2008 in Vanilla 1.0 Help
Password Reset

Comments

  • Options
    sweet addon

    does this work for sure
    or is it a beta?
    jw
    thank you in advance
  • Options
    Installing this and enabling this gives the following error message:

    Some problems were encountered
    Appending of permission definition to "\languages\English\definitions.php" for Password Reset 0.1 has failed.
    Failed Password Reset 0.1 Installation!

    Looking at the code it looks like it is attempting to manipulate the conf/language.php file. Aren't all customizations supposed to refrain from this? According to conf/readme.txt:

    This file is not edited by Vanilla in any way. It's purpose is to allow you
    to re-define language definitions made in
    /languages/yourlanguage/definitions.php. You should NEVER edit the files in
    your /languages folder. You should always copy the definition you want to
    change into this file and edit it here.
  • Options
    Yes, it looks like the add-on is trying to write a definition to your definitions file.
    I agree this should not be done, but the author is probably trying to save you some work.
    Maybe set the permission to 777, let it do its thing then set it back, but do back it up first.
  • Options
    it is strange, add-on should define English definitions as default in default.php by $Context->SetDefinition('term', 'definition');

    This is manifestation of lack of standardized way of managing extension translations.
    That's the reason I made Extension Language Loader as a try to bring some "standard", so either language add-on maintainers can easily add extensions' translations either extension add-on maintaners can add whatever translations coming together with the extension add-on.
  • Options
    Yes i am writing to the conf/language file. All i am adding however is just 1 definition line. nothing else. The definition just serves a purpose when the extension is disabled. It changes the definition used by vanilla, so it prettifies the permissions viewd in "Roles & Permissions settings" when this particular extension is disabled. If i get more complains of this i will remove this from further builds.
    And i guess i must have put in the wrong description for error trapping, as i am only adding a definition to the conf/language.php.
    And this is what the readme actually says about the language file.
    This file is not edited by Vanilla in any way. It's purpose is to allow you
    to re-define language definitions made in
    /languages/yourlanguage/definitions.php. You should NEVER edit the files in
    your /languages folder. You should always copy the definition you want to
    change into this file and edit it here
    @ Klip, yes i understand what you mean, but not sure if you guys noticed, when an extension is disabled, the permissions still retain in the database and as such since the definitions are mentioned in the extension and the extension default isn't being read, the permissions definitions are null. So what i'm doing is just providing a descriptive prettified definition.
  • Options
    @vanoob, IMHO then it should be done in a different way :)

    problem with using conf/language.php is, that it overrides any language definition defined before, so even I choose another then English language (and there is definition in another then English language), it will be always English.

    Also in default.php on line 44 there is:$Context->Dictionary['PERMISSION_USER_PASSWORD_RESET'] = 'Can Reset/Change any Account Password';and it overrides that again :)

    I can see what you mean now so I tried to adjust your code so it would work as I think it should work.
    You define definition in conf/language.php telling that extension is not enabled and in extension you change it so it says the definition without that 'not-enabled' notice.

    I would recommend to do it little bit different.
    I think you should add SetDefinition call in conf/language.php instead of seting the Dictionary definition directly. And in default.php you can do regexp replace of /\[.*\]\s*/ so it removes the notice in Dictionary. In this way it is still defined even the extension is disabled and if it is enabled it removes the "[!Extension Not Enabled] "
    And it allows others to define translations of it.

    Also I get this warning because my install is on linux
    Warning: file_get_contents(/var/www/vanilla/\conf\language.php) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/vanilla/extensions/PasswordReset/default.php on line 54
    there should be 'conf/language.php' at 54 and 56 lines instead of '\conf\langauge.php'. If it does problems on Windows there should be used DIRECTORY_SEPARATOR constant, which contains '/' or '\' depending on the system.

    So here is diff of changes I did:
    44,45c44,47 < $Context->Dictionary['PERMISSION_USER_PASSWORD_RESET'] = 'Can Reset/Change any Account Password'; < --- > if (isset( $Context->Dictionary['PERMISSION_USER_PASSWORD_RESET'] )) { > $Context->Dictionary['PERMISSION_USER_PASSWORD_RESET'] = preg_replace( '/\[.*\]\s*/', '', $Context->Dictionary['PERMISSION_USER_PASSWORD_RESET']); > } > 48,51c50,52 < $Language = "\n// Added for Password Reset Extension < \$Context->Dictionary['PERMISSION_USER_PASSWORD_RESET'] < = '[!Extension Not Enabled] Can Reset/Change any Account Password'; < "; --- > $Language = "\n// Added for Password Reset Extension > \$Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password' ); > "; 54,56c55,57 < $file = file_get_contents($Configuration['APPLICATION_PATH'].'\conf\language.php'); < if(!strpos($file, "\$Context->Dictionary['PERMISSION_USER_PASSWORD_RESET']")) { < if (!AppendToConfigurationFile($Configuration['APPLICATION_PATH'].'\conf\language.php', $Language)) { --- > $file = file_get_contents($Configuration['APPLICATION_PATH'].'conf/language.php'); > if(!strpos($file, "\$Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET',")) { > if (!AppendToConfigurationFile($Configuration['APPLICATION_PATH'].'conf/language.php', $Language)) {
  • Options
    Uploaded version 0.2 of Password Reset.
  • Options
    Well guys under advisement from Klip, i have made the modifications and have tested it on my system, and it works alright. Thank you Klip for the modifications you suggested, hopefully that will be more friendly for others who define their own language file.

    And just to affirm this for various people, the extension still writes to conf/language.php.

    For all those who installed version 0.1 and want to make your vanilla install more friendly towards other languages as klip suggested. You will need to modify the conf/language.php file.

    1. Find the following lines in conf/language.php // Added for Password Reset Extension $Context->Dictionary['PERMISSION_USER_PASSWORD_RESET'] = '[!Extension Not Enabled] Can Reset/Change any Account Password'; 2. Replace them with // Added for Password Reset Extension $Context->SetDefinition('PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password');
  • Options
    sorry, but I have problem with youre addon:

    termsofservice.php
    Fatal error: Call to undefined method FauxContext::SetDefinition() in /conf/language.php on line 5

    language.php:
    <?php // Custom Language Definitions // Added for Password Reset Extension $Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password' ); // Added for Password Reset Extension $Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password' ); // Added for Password Reset Extension $Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password' ); // Added for Password Reset Extension $Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password' ); // Added for Password Reset Extension $Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password' ); // Added for Password Reset Extension $Context->SetDefinition( 'PERMISSION_USER_PASSWORD_RESET', '[!Extension Not Enabled] Can Reset/Change any Account Password' ); ?>
  • Options
    What version of vanilla are you running?
  • Options
    I'm leaning towards with minisweeper, what version of Vanilla might you be running, as i believe setdefinition was a relatively new function. As for the termsofservice.php file... my extension does not touch that at all.

    Now you've brought up something interesting for me, seems i may have neglected to update the proper error trapping for the initial install which lead to your multiple definition lines. I will fix this in the next release, also i'm not sure what exactly happens with multiple setdefinitions. maybe only the last line will be effective, but in any case remove those other uneeded lines.
  • Options
    Just installed this addon and received the following error. Parse error: parse error, unexpected T_OBJECT_OPERATOR in /home/content/v/m/e/vm/html/jjdforum/extensions/PasswordReset/default.php on line 83 Any help, I am running Vanilla 1.1.4...
  • Options
    @masterwizard, just another question. Do you know what version of php your host is running?

    --Edited
    Masterwizards problem was observed when running password reset on php4, new version should now correct this.
  • Options
    Okay guys. I've fixed a couple of stuff and changed a couple of things within this extension, one main change is i altered the way this extension saves the users passwords. I didn't tried testing this extension with vanilla 1.1.5 RC hence the delayed uploading of the package. But since 1.1.5 is out now i will be testing the new package and upload it by late weekend or monday.
  • Options
    Version number changed from 0.2 to 0.3.
  • Options
    Uploaded version 0.3 of Password Reset.
  • Options
    I was able to Install the latest version of Password Reset. How do you get to use it? I must be missing something. I don't see how you can reset a users password.
  • Options
    okay first step after installing the extension, you will need to edit roles to give permissions for a selected role to be able to reset a users password.
    So navigate to Settings->Roles & Permissions
    Then you want to select the role that you want to give permissions to.
    Scroll down the list and find "Can Reset/Change any Account Password" and tick the checkbox next to it. Save the permission settings for that role.

    Then to reset the password of an account, all you have to do is make sure you are part of the role that can reset passwords, navigate to the account you want to reset. On the left hand menu you can find "reset password". click on that and follow the prompts.

    NOTE: You can't reset your own password, this is to prevent hijacked accounts (ie public computer, remember me setting) from resetting the accounts password and steal your account. Also there is a list of user accounts that can't be reset (defaulted to first account created) which can be changed by editing the default.php file.

    Hope that helps, a very long winded answer to a simple solution.
  • Options
    Yes thank you very much. As often is the case I enter a question and then read some doc and figure it out. Hope this will help someone else.
This discussion has been closed.