View | Details | Raw Unified | Return to bug 24949
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/css/login.css (+9 lines)
Lines 158-160 input[type="password"] { Link Here
158
    font-size: 1.7em;
158
    font-size: 1.7em;
159
    width: 97%;
159
    width: 97%;
160
}
160
}
161
162
.show-password-toggle {
163
    margin: .7rem 0;
164
}
165
166
input.show-password-toggle-checkbox {
167
    float: left;
168
    margin: 0 .5rem 0 0;
169
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt (-4 / +5 lines)
Lines 169-180 Link Here
169
                    [% NEXT IF INPUT.name == "branch" %]
169
                    [% NEXT IF INPUT.name == "branch" %]
170
                    <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
170
                    <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
171
                [% END %]
171
                [% END %]
172
                <p
172
                <p>
173
                    ><label for="userid">Username:</label>
173
                    <label for="userid">Username:</label>
174
                    <input type="text" name="login_userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" autocomplete="off" />
174
                    <input type="text" name="login_userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" autocomplete="off" />
175
                </p>
175
                </p>
176
                <p
176
                <p>
177
                    ><label for="password">Password:</label>
177
                    <label for="password">Password:</label>
178
                    <input type="password" name="login_password" id="password" class="input" value="" size="20" tabindex="2" autocomplete="off" />
178
                    <input type="password" name="login_password" id="password" class="input" value="" size="20" tabindex="2" autocomplete="off" />
179
                </p>
179
                </p>
180
180
Lines 291-296 Link Here
291
<!-- /.main.container-fluid -->
291
<!-- /.main.container-fluid -->
292
292
293
[% MACRO jsinclude BLOCK %]
293
[% MACRO jsinclude BLOCK %]
294
    [% Asset.js("js/show-password-toggle.js") | $raw %]
294
    <script>
295
    <script>
295
        $(document).ready( function() {
296
        $(document).ready( function() {
296
            if ( document.location.hash ) {
297
            if ( document.location.hash ) {
(-)a/koha-tmpl/intranet-tmpl/prog/js/show-password-toggle.js (+44 lines)
Line 0 Link Here
1
function create_show_password_toggle(loop_counter) {
2
    const container = document.createElement("div");
3
    container.className = "show-password-toggle";
4
5
    const checkbox = document.createElement("input");
6
    checkbox.type = "checkbox";
7
    checkbox.className = "show-password-toggle-checkbox";
8
    checkbox.id = `show-password-toggle-checkbox-${loop_counter}`;
9
10
    const label = document.createElement("label");
11
    label.className = "show-password-toggle-label";
12
    label.htmlFor = checkbox.id;
13
    label.textContent = " " + __("Show password");
14
15
    container.appendChild(checkbox);
16
    container.appendChild(label);
17
18
    return container;
19
}
20
21
document.addEventListener("DOMContentLoaded", function () {
22
    const local_logins = document.querySelectorAll(".validated");
23
    local_logins.forEach((local_login, i) => {
24
        let show_password_toggle_node = create_show_password_toggle(i);
25
        local_login
26
            .querySelector("input[type='password']")
27
            .after(show_password_toggle_node);
28
        const password_field = local_login.querySelector(
29
            "#password,#mpassword"
30
        );
31
        const toggle_box = local_login.querySelector(
32
            "input.show-password-toggle-checkbox"
33
        );
34
        if (password_field && toggle_box) {
35
            toggle_box.addEventListener("click", function (ev) {
36
                if (password_field.type === "password") {
37
                    password_field.type = "text";
38
                } else {
39
                    password_field.type = "password";
40
                }
41
            });
42
        }
43
    });
44
});
(-)a/t/db_dependent/selenium/authentication.t (-2 / +17 lines)
Lines 43-49 SKIP: { Link Here
43
    my $driver  = $s->driver;
43
    my $driver  = $s->driver;
44
44
45
    subtest 'Staff interface authentication' => sub {
45
    subtest 'Staff interface authentication' => sub {
46
        plan tests => 7;
46
        plan tests => 9;
47
        my $mainpage = $s->base_url . q|mainpage.pl|;
47
        my $mainpage = $s->base_url . q|mainpage.pl|;
48
        $driver->get($mainpage);
48
        $driver->get($mainpage);
49
        like( $driver->get_title, qr(Log in to Koha), 'Hitting the main page should redirect to the login form' );
49
        like( $driver->get_title, qr(Log in to Koha), 'Hitting the main page should redirect to the login form' );
Lines 60-65 SKIP: { Link Here
60
            'Patron without permission should be redirected to the login form'
60
            'Patron without permission should be redirected to the login form'
61
        );
61
        );
62
62
63
        is(
64
            $driver->find_element('//input[@id="password"]')->get_attribute('type'),
65
            'password',
66
            'Password field is obscured initially'
67
        );
68
69
        $driver->find_element('//input[@class="show-password-toggle-checkbox"]')->click;
70
71
        is(
72
            $driver->find_element('//input[@id="password"]')->get_attribute('type'),
73
            'text',
74
            'Password field is shown'
75
        );
76
77
        $driver->find_element('//input[@class="show-password-toggle-checkbox"]')->click;
78
63
        # Try logging in as someone else (even a non-existent patron) and you should still be denied access
79
        # Try logging in as someone else (even a non-existent patron) and you should still be denied access
64
        $s->auth( 'Bond', 'James Bond' );
80
        $s->auth( 'Bond', 'James Bond' );
65
        like(
81
        like(
66
- 

Return to bug 24949