Bugzilla – Attachment 84207 Details for
Bug 22061
Add route to change patron's password (public)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22061: (QA follow-up) Rename password_2 => password_repeated
Bug-22061-QA-follow-up-Rename-password2--passwordr.patch (text/plain), 6.12 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-01-18 16:36:15 UTC
(
hide
)
Description:
Bug 22061: (QA follow-up) Rename password_2 => password_repeated
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-01-18 16:36:15 UTC
Size:
6.12 KB
patch
obsolete
>From ea38d84021d5b31f87c17fea9af6b8539872bd86 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 18 Jan 2019 13:34:55 -0300 >Subject: [PATCH] Bug 22061: (QA follow-up) Rename password_2 => > password_repeated > >As voted when the RFC was discussed, the attribute gets renamed. The >tests are adjusted accordingly. > >To test: >- Run: > $ kshell > k$ prove t/db_dependent/api/v1/patrons_password.t >=> SUCCESS: Tests pass! > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1/Patrons/Password.pm | 2 +- > api/v1/swagger/paths/public_patrons.json | 4 +- > t/db_dependent/api/v1/patrons_password.t | 55 +++++++++++++++++------- > 3 files changed, 43 insertions(+), 18 deletions(-) > >diff --git a/Koha/REST/V1/Patrons/Password.pm b/Koha/REST/V1/Patrons/Password.pm >index a9c4aa86ca..013380b281 100644 >--- a/Koha/REST/V1/Patrons/Password.pm >+++ b/Koha/REST/V1/Patrons/Password.pm >@@ -108,7 +108,7 @@ sub set_public { > > my $old_password = $body->{old_password}; > my $password = $body->{password}; >- my $password_2 = $body->{password_2}; >+ my $password_2 = $body->{password_repeated}; > > unless ( $password eq $password_2 ) { > return $c->render( status => 400, openapi => { error => "Passwords don't match" } ); >diff --git a/api/v1/swagger/paths/public_patrons.json b/api/v1/swagger/paths/public_patrons.json >index 29ce642d83..74838a078b 100644 >--- a/api/v1/swagger/paths/public_patrons.json >+++ b/api/v1/swagger/paths/public_patrons.json >@@ -21,7 +21,7 @@ > "description": "New password (plain text)", > "type": "string" > }, >- "password_2": { >+ "password_repeated": { > "description": "Repeated new password (plain text)", > "type": "string" > }, >@@ -30,7 +30,7 @@ > "type": "string" > } > }, >- "required": ["password", "password_2", "old_password"] >+ "required": ["password", "password_repeated", "old_password"] > } > } > ], >diff --git a/t/db_dependent/api/v1/patrons_password.t b/t/db_dependent/api/v1/patrons_password.t >index e3213db7f4..2585018229 100644 >--- a/t/db_dependent/api/v1/patrons_password.t >+++ b/t/db_dependent/api/v1/patrons_password.t >@@ -139,10 +139,15 @@ subtest 'set_public() (unprivileged user tests)' => sub { > > my $new_password = 'abc'; > >- my $tx >- = $t->ua->build_tx( POST => "/api/v1/public/patrons/" >+ my $tx = $t->ua->build_tx( >+ POST => "/api/v1/public/patrons/" > . $other_patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password, old_password => 'blah' } ); >+ . "/password" => json => { >+ password => $new_password, >+ password_repeated => $new_password, >+ old_password => 'blah' >+ } >+ ); > > $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); > $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); >@@ -156,10 +161,15 @@ subtest 'set_public() (unprivileged user tests)' => sub { > > my $password = 'holapassword'; > $patron->set_password( $password ); >- $tx >- = $t->ua->build_tx( POST => "/api/v1/public/patrons/" >+ $tx = $t->ua->build_tx( >+ POST => "/api/v1/public/patrons/" > . $other_patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password, old_password => $password } ); >+ . "/password" => json => { >+ password => $new_password, >+ password_repeated => $new_password, >+ old_password => $password >+ } >+ ); > > $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); > $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); >@@ -169,10 +179,15 @@ subtest 'set_public() (unprivileged user tests)' => sub { > error => "Changing other patron's password is forbidden" > }); > >- $tx >- = $t->ua->build_tx( POST => "/api/v1/public/patrons/" >+ $tx = $t->ua->build_tx( >+ POST => "/api/v1/public/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => 'wrong_password', old_password => $password } ); >+ . "/password" => json => { >+ password => $new_password, >+ password_repeated => 'wrong_password', >+ old_password => $password >+ } >+ ); > > $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); > $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); >@@ -182,10 +197,15 @@ subtest 'set_public() (unprivileged user tests)' => sub { > error => "Passwords don't match" > }); > >- $tx >- = $t->ua->build_tx( POST => "/api/v1/public/patrons/" >+ $tx = $t->ua->build_tx( >+ POST => "/api/v1/public/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password, old_password => 'badpassword' } ); >+ . "/password" => json => { >+ password => $new_password, >+ password_repeated => $new_password, >+ old_password => 'badpassword' >+ } >+ ); > > $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); > $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); >@@ -195,10 +215,15 @@ subtest 'set_public() (unprivileged user tests)' => sub { > error => "Invalid password" > }); > >- $tx >- = $t->ua->build_tx( POST => "/api/v1/public/patrons/" >+ $tx = $t->ua->build_tx( >+ POST => "/api/v1/public/patrons/" > . $patron->id >- . "/password" => json => { password => $new_password, password_2 => $new_password, old_password => $password } ); >+ . "/password" => json => { >+ password => $new_password, >+ password_repeated => $new_password, >+ old_password => $password >+ } >+ ); > > $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); > $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22061
:
83613
|
83614
|
83680
|
83681
|
83682
|
83755
|
83756
|
83764
|
83765
|
83766
|
83767
|
83768
|
84207
|
84288
|
84289
|
84290
|
84291
|
84292
|
84293
|
84294
|
84489