Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 28343462d -> 2303ddd40


fix a merge issues in "create user" API + moving Change TO password hashing to 
scrypt


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/11f90de2
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/11f90de2
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/11f90de2

Branch: refs/heads/master
Commit: 11f90de24f5e1e99c9ddfb0eda65695b6e98ba7f
Parents: 2834346
Author: nir-sopher <n...@qwilt.com>
Authored: Tue Jun 20 08:04:10 2017 +0300
Committer: Jeremy Mitchell <mitchell...@gmail.com>
Committed: Tue Jun 27 15:57:56 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/User.pm        |  4 ++--
 traffic_ops/app/t/api/1.2/user_admin.t | 10 +++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/11f90de2/traffic_ops/app/lib/API/User.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/User.pm b/traffic_ops/app/lib/API/User.pm
index 06f2e59..117030d 100644
--- a/traffic_ops/app/lib/API/User.pm
+++ b/traffic_ops/app/lib/API/User.pm
@@ -265,8 +265,8 @@ sub create {
                role                 => $params->{role},
                state_or_province    => $params->{stateOrProvince},
                username             => $params->{username},
-               local_passwd         => sha1_hex( $params->{localPassword} ),
-               confirm_local_passwd => sha1_hex( 
$params->{confirmLocalPassword} ),
+               local_passwd         => Utils::Helper::hash_pass( 
$params->{localPasswd} ),
+               confirm_local_passwd => Utils::Helper::hash_pass( 
$params->{confirmLocalPasswd} ),
                tenant_id            => $tenant_id,
        };
 

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/11f90de2/traffic_ops/app/t/api/1.2/user_admin.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/user_admin.t 
b/traffic_ops/app/t/api/1.2/user_admin.t
index 1a71836..ec7b82b 100644
--- a/traffic_ops/app/t/api/1.2/user_admin.t
+++ b/traffic_ops/app/t/api/1.2/user_admin.t
@@ -83,7 +83,15 @@ sub run_ut {
                ->status_is(400)->or( sub { diag 
$t->tx->res->content->asset->{content}; } )
               , 'Success same email...';
               
-       my $userid = $schema->resultset('TmUser')->find( { username => 
$addedUserName } )->id, 'Does the portal user exist?';
+       my $userid = $schema->resultset('TmUser')->find( { username => 
$addedUserName } )->id, 'Does the user exist?';
+
+       #login as the user, and do something, to verify the user can log in 
with the given password
+       ok $t->get_ok('/logout')->status_is(302)->or( sub { diag 
$t->tx->res->content->asset->{content}; } );
+       ok $t->post_ok( '/login', => form => { u => $addedUserName, p => 
"longerpass"} )->status_is(302);
+       ok $t->get_ok('/api/1.2/users/'.$userid)->status_is(200);
+       #back to the standard user
+       ok $t->get_ok('/logout')->status_is(302)->or( sub { diag 
$t->tx->res->content->asset->{content}; } );
+       ok $t->post_ok( '/login', => form => { u => $login_user, p => 
$login_password} )->status_is(302);
               
        if (defined($tenant_id)){
                #verify the update with no "tenant" removed the tenant

Reply via email to