'lost_password_link' from config.php don't work as expected #24789

Closed
michaelstingl opened this Issue May 23, 2016 · 4 comments

Projects

None yet

2 participants

@michaelstingl

Steps to reproduce

  1. configure LDAP authentication in ownCloud
  2. set 'lost_password_link' => 'https://example.org/link/to/password/reset', in config/config.php
  3. try to login with LDAP user and wrong password

Expected behaviour

"Wrong password. Reset it?" should be a link to https://example.org/link/to/password/reset'

Actual behaviour

"Wrong password. Reset it?" don't link to https://example.org/link/to/password/reset'

<a id="lost-password" class="warning" href="">
            Wrong password. Reset it?       </a>

Here you can find this parameter:

config/config.sample.php#L216-L222

/**
 * If your user backend does not allow to reset the password (e.g. when it's a
 * read-only user backend like LDAP), you can specify a custom link, where the
 * user is redirected to, when clicking the "reset password" link after a failed
 * login-attempt.
 */
'lost_password_link' => 'https://example.org/link/to/password/reset',

core/templates/login.php#L59-L67

        <?php if (!empty($_['invalidpassword']) && !empty($_['canResetPassword'])) { ?>
        <a id="lost-password" class="warning" href="">
            <?php p($l->t('Wrong password. Reset it?')); ?>
        </a>
        <?php } else if (!empty($_['invalidpassword'])) { ?>
            <p class="warning">
                <?php p($l->t('Wrong password.')); ?>
            </p>
        <?php } ?>

It would be cool if the href value could be the parameter from the config.php.

@MTRichards described this behaviour in the acceptance criteria from #12215 (comment) .

Server configuration

Ubuntu

Web server:
Apache

Database:
MariaDB

PHP version:

ownCloud version: (see ownCloud admin page)
9.0.2

Updated from an older ownCloud or fresh install:
fresh install

Where did you install ownCloud from:
appliance

Signing status (ownCloud 9.0 and above):

No errors have been found.

List of activated apps:

root@owncloud:/var/www/owncloud# sudo -u www-data php occ app:list
Enabled:
  - activity: 2.2.1
  - admin_audit: 0.7
  - comments: 0.2
  - dav: 0.1.6
  - enterprise_key: 0.1.0
  - federatedfilesharing: 0.1.0
  - federation: 0.0.4
  - files: 1.4.4
  - files_drop: 0.4.1
  - files_external: 0.5.2
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_versions: 1.2.0
  - files_videoplayer: 0.9.8
  - firewall: 2.3.0
  - firstrunwizard: 1.1
  - gallery: 14.5.0
  - notifications: 0.2.3
  - provisioning_api: 0.4.1
  - systemtags: 0.2
  - templateeditor: 0.1
  - updatenotification: 0.1.0
  - user_ldap: 0.8.0
  - windows_network_drive: 0.2.33
  - workflow: 0.1.3
Disabled:
  - announcementcenter
  - encryption
  - external
  - files_antivirus
  - files_ldap_home
  - objectstore
  - password_policy
  - sharepoint
  - user_external
  - user_shibboleth

The content of config/config.php:

root@owncloud:/var/www/owncloud# sudo -u www-data php occ config:list system
{
    "system": {
        "updatechecker": false,
        "supportedDatabases": [
            "mysql",
            "pgsql",
            "oci"
        ],
        "license-key": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "DISABLED.memcache.locking": "\\OC\\Memcache\\Redis",
        "DISABLED.memcache.distributed": "\\OC\\Memcache\\Redis",
        "Redis": {
            "host": "\/var\/run\/redis\/redis.sock",
            "port": 0,
            "timeout": 0
        },
        "instanceid": "ock37hvwyow4",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "172.18.16.152",
            "owncloud",
            "172.18.16.152"
        ],
        "datadirectory": "\/var\/lib\/owncloud",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbtype": "mysql",
        "version": "9.0.2.2",
        "dbname": "oc",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "ldapIgnoreNamingRules": false,
        "lost_password_link": "https:\/\/example.org\/link\/to\/password\/reset"
    }
}

Are you using external storage, if yes which one: local/smb/sftp/...
no

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
LDAP

LDAP configuration (delete this part if not used)

root@owncloud:/var/www/owncloud# sudo -u www-data php occ ldap:show-config
+-------------------------------+------------------------------------------------+
| Configuration                 | s01                                            |
+-------------------------------+------------------------------------------------+
| hasMemberOfFilterSupport      |                                                |
| hasPagedResultSupport         |                                                |
| homeFolderNamingRule          |                                                |
| lastJpegPhotoLookup           | 0                                              |
| ldapAgentName                 | cn=admin,dc=example,dc=com                     |
| ldapAgentPassword             | ***                                            |
| ldapAttributesForGroupSearch  |                                                |
| ldapAttributesForUserSearch   |                                                |
| ldapBackupHost                |                                                |
| ldapBackupPort                |                                                |
| ldapBase                      | dc=example,dc=com                              |
| ldapBaseGroups                | dc=example,dc=com                              |
| ldapBaseUsers                 | dc=example,dc=com                              |
| ldapCacheTTL                  | 600                                            |
| ldapConfigurationActive       | 1                                              |
| ldapDynamicGroupMemberURL     |                                                |
| ldapEmailAttribute            |                                                |
| ldapExperiencedAdmin          | 0                                              |
| ldapExpertUUIDGroupAttr       |                                                |
| ldapExpertUUIDUserAttr        |                                                |
| ldapExpertUsernameAttr        | uid                                            |
| ldapGroupDisplayName          | cn                                             |
| ldapGroupFilter               | (&(|(objectclass=posixGroup))(|(cn=owncloud))) |
| ldapGroupFilterGroups         | owncloud                                       |
| ldapGroupFilterMode           | 0                                              |
| ldapGroupFilterObjectclass    | posixGroup                                     |
| ldapGroupMemberAssocAttr      | uniqueMember                                   |
| ldapHost                      | 172.18.16.229                                  |
| ldapIgnoreNamingRules         |                                                |
| ldapLoginFilter               | (&(|(objectclass=posixAccount))(uid=%uid))     |
| ldapLoginFilterAttributes     |                                                |
| ldapLoginFilterEmail          | 0                                              |
| ldapLoginFilterMode           | 0                                              |
| ldapLoginFilterUsername       | 1                                              |
| ldapNestedGroups              | 0                                              |
| ldapOverrideMainServer        |                                                |
| ldapPagingSize                | 500                                            |
| ldapPort                      | 389                                            |
| ldapQuotaAttribute            |                                                |
| ldapQuotaDefault              |                                                |
| ldapTLS                       | 0                                              |
| ldapUserDisplayName           | cn                                             |
| ldapUserDisplayName2          |                                                |
| ldapUserFilter                | (|(objectclass=posixAccount))                  |
| ldapUserFilterGroups          |                                                |
| ldapUserFilterMode            | 0                                              |
| ldapUserFilterObjectclass     | posixAccount                                   |
| ldapUuidGroupAttribute        | auto                                           |
| ldapUuidUserAttribute         | auto                                           |
| turnOffCertCheck              | 0                                              |
| useMemberOfToDetectMembership | 1                                              |
+-------------------------------+------------------------------------------------+

Client configuration

Browser:
Chrome 50

Operating system:
Mac OS X 10.11.4

@VicDeo @nickvergessen I've seen you worked on these lines of code before. Could you check again?

00005530

@nickvergessen
Contributor

On hover the link indeed shows the current URL, but when clicking it redirects me to example.org

@michaelstingl

@nickvergessen Oh, thanks. I opened the link in a new tab to come back to the login page later.

Could you insert the lost_password_link value into the href="" in DOM either by JS or PHP?

@nickvergessen nickvergessen self-assigned this May 24, 2016
@nickvergessen nickvergessen added this to the 9.1-current milestone May 24, 2016
@PVince81 PVince81 closed this in #24795 May 31, 2016
@michaelstingl

@nickvergessen @PVince81 Could you backport this to stable9 and stable8.2 ? (I've seen core/Controller/LoginController.php don't exist there)

@nickvergessen
Contributor

Backports:
9.0 #24921
8.2 #24924

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment