Struct goose_eggs::drupal::Login[][src]

pub struct Login<'a> { /* fields omitted */ }
Expand description

Set one or more defaults when logging in through the standard drupal user-login-form.

This object is passed to log_in to set a custom default username and/or password and/or log in url and/or the required title after login.

Example

use goose_eggs::drupal::Login;

fn examples() {
    // Manually build a Login structure with custom username and password.
    let _login = Login::new(Some("foo"), Some("bar"), None, None);

    // Call `Login::username_password` to build the same.
    let mut login = Login::username_password("foo", "bar");

    // Now also change the url and expected title.
    login.unwrap().update_url_title("/custom/user/login", "Custom title");
}

Implementations

Create a new Login object, specifying username, password, url, and expected title.

It’s generally preferred to use a helper such as Login::username_password or Login::url_title instead of invoking this function directly.

Example

use goose_eggs::drupal::Login;

let _login = Login::new(
    // Set a default username of "foo".
    Some("foo"),
    // Set a default password of "bar".
    Some("bar"),
    // Set a custom log-in path of "/custom/login/path".
    Some("/custom/login/path"),
    // Set a custom title to validate after log-in.
    Some("Custom Title"),
);

Create a Login object setting a custom default username.

The password will remain the default of password. The login url will remain the default of /user/login. After login the title will be validated to confirm it include’s the username. The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let _login = Login::username("foo");

Create a Login object setting a custom default password.

The username will remain the default of username. The login url will remain the default of /user/login. After login the title will be validated to confirm it include’s the username. The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let _login = Login::password("bar");

Create a Login object setting a custom default username and password.

The login url will remain the default of /user/login. After login the title will be validated to confirm it include’s the username. The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let _login = Login::username_password("foo", "bar");

Create a Login object with a custom default login url.

The username will remain the default of username. The password will remain the default of password. After login the title will be validated to confirm it include’s the username. The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let _login = Login::password("bar");

Example

use goose_eggs::drupal::Login;

let _login = Login::url("/custom/user/login");

Create a Login object with a custom expected title after login.

The username will remain the default of username. The password will remain the default of password. The login url will remain the default of /user/login. The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let _login = Login::password("bar");

Example

use goose_eggs::drupal::Login;

let _login = Login::title("Custom title");

Create a Login object with custom default url and a custom expected title after login.

The username will remain the default of username. The password will remain the default of password. The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let _login = Login::password("bar");

Example

use goose_eggs::drupal::Login;

let _login = Login::url_title("/custom/login/path", "Custom title");

Update a Login object, changing the default username.

The password, url and title fields will not be changed.

The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let login =
    Login::password("bar")
        .unwrap()
        .update_username("foo");

Update a Login object, changing the default password.

The username, url and title fields will not be changed.

The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let login =
    Login::username("foo")
        .unwrap()
        .update_password("bar");

Update a Login object, changing the default username and password.

The url and title fields will not be changed.

The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let login =
    Login::username_password("foo", "bar")
        .unwrap()
        .update_username_password("changed-username", "changed-password");

Update a Login object, changing the default login url.

The username, password and title fields will not be changed.

The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let login =
    Login::username("foo")
        .unwrap()
        .update_url("/custom/user/login");

Update a Login object, changing the expected title after login.

The username and password fields will not be changed.

The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let login =
    Login::username("foo")
        .unwrap()
        .update_title("Custom Title");

Update a Login object, changing the default login url and the expected title after login.

The username and password fields will not be changed.

The username and password defaults can still be overridden by the GOOSE_USER and GOOSE_PASS environment variables.

Example

use goose_eggs::drupal::Login;

let login =
    Login::username_password("foo", "password")
        .unwrap()
        .update_url_title("/custom/user/login", "Custom Title");

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.