auth::password::get_forgotten_url (public)

 auth::password::get_forgotten_url [ -authority_id authority_id ] \
    [ -username username ] [ -email email ] [ -remote_only ]

Defined in packages/acs-authentication/tcl/password-procs.tcl

Returns the URL to redirect to for forgotten passwords.

Switches:
-authority_id (optional)
The ID of the authority that the user is trying to log into.
-username (optional)
The username that the user's trying to log in with.
-email (optional)
-remote_only (optional, boolean)
If provided, only return any remote URL (not on this server).
Returns:
A URL that can be linked to when the user has forgotten his/her password, or the empty string if none can be found.

Partial Call Graph (max 5 caller/called nodes):
%3 test_auth_password_get_forgotten_url auth_password_get_forgotten_url (test acs-authentication) auth::password::get_forgotten_url auth::password::get_forgotten_url test_auth_password_get_forgotten_url->auth::password::get_forgotten_url acs_user::get_user_info acs_user::get_user_info (public) auth::password::get_forgotten_url->acs_user::get_user_info auth::authority::get_element auth::authority::get_element (public) auth::password::get_forgotten_url->auth::authority::get_element auth::authority::local auth::authority::local (public) auth::password::get_forgotten_url->auth::authority::local auth::password::can_reset_p auth::password::can_reset_p (public) auth::password::get_forgotten_url->auth::password::can_reset_p auth::password::can_retrieve_p auth::password::can_retrieve_p (public) auth::password::get_forgotten_url->auth::password::can_retrieve_p auth::password::email_password auth::password::email_password (private) auth::password::email_password->auth::password::get_forgotten_url auth::password::recover_password auth::password::recover_password (public) auth::password::recover_password->auth::password::get_forgotten_url packages/acs-subsite/lib/login.tcl packages/acs-subsite/ lib/login.tcl packages/acs-subsite/lib/login.tcl->auth::password::get_forgotten_url

Testcases:
auth_password_get_forgotten_url
Source code:
    if { $username ne "" } {
        set local_url [export_vars -no_empty -base "[subsite::get_element -element url]register/recover-password" { authority_id username }]
    } else {
        set local_url [export_vars -no_empty -base "[subsite::get_element -element url]register/recover-password" { email }]
    }
    set forgotten_pwd_url {}

    if { $username ne "" } {
        if { $authority_id eq "" } {
            set authority_id [auth::authority::local]
        }
    } else {
        set user_id [party::get_by_email -email $email]
        if { $user_id ne "" } {
            set user [acs_user::get_user_info -user_id $user_id]
            set authority_id [dict get $user authority_id]
            set username     [dict get $user username]
        }
    }

    if { $username ne "" } {
        # We have the username or email


        set forgotten_pwd_url [auth::authority::get_element -authority_id $authority_id -element forgotten_pwd_url]

        if { $forgotten_pwd_url ne "" } {
            regsub -all "{username}" $forgotten_pwd_url $username forgotten_pwd_url
        } elseif { !$remote_only_p } {
            if { [auth::password::can_retrieve_p -authority_id $authority_id] || [auth::password::can_reset_p -authority_id $authority_id] } {
                set forgotten_pwd_url $local_url
            }
        }
    } else {
        # We don't have the username
        if { !$remote_only_p } {
            set forgotten_pwd_url "[subsite::get_element -element url]register/recover-password"
        }
    }

    return $forgotten_pwd_url
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: