Changeset 870 for LATMOS-Accounts-Web
- Timestamp:
- 12/23/11 16:13:29 (13 years ago)
- Location:
- LATMOS-Accounts-Web/lib/LATMOS/Accounts
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web.pm
r862 r870 22 22 Authentication 23 23 Prototype 24 XMLRPC 24 25 /; 25 26 -
LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/About.pm
r861 r870 27 27 } 28 28 29 sub echo : XMLRPC { 30 my ( $self, $c, @args ) = @_; 31 return RPC::XML::fault->new( 400, "No input!" 32 ) unless @args; 33 return join ' ', @args; 34 } 29 35 30 36 =head1 AUTHOR -
LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Users.pm
r861 r870 48 48 } 49 49 50 51 sub change_password : Private { 52 my ($self, $c, $username, $password) = @_; 53 54 my $base = $c->model('Accounts')->db; 55 $c->stash->{user} = $base->get_object('user', $username) or do { 56 $c->forward('/no_object'); 57 return "Cannot get user object"; 58 }; 59 60 my $sync = $c->model('Accounts')->sync_access; 61 62 # This is widelly burk: 63 # synchaccess do not manage connect() at time, opening a 64 # backdoor then :\ 65 foreach ($sync->bases) { $_->{_user} = $username } 66 67 my $suser = $sync->get_object('user', $username); 68 my $msg = $c->stash->{user}->check_password($password); 69 if ($msg ne 'ok') { 70 return $msg . ', mot de passe inchangé'; 71 } elsif ($suser && $suser->set_password($password)) { 72 $sync->commit; 73 return; 74 } else { 75 return 'Erreur lors du changement de mot de passe'; 76 } 77 } 78 50 79 sub default : LocalPath { 51 80 my ( $self, $c, undef, $username, $subform, $arg ) = @_; … … 68 97 if ($c->req->param('passwd')) { 69 98 if ($c->req->param('passwd') eq ($c->req->param('cpasswd') || '')) { 70 my $sync = $c->model('Accounts')->sync_access; 71 72 # This is widelly burk: 73 # synchaccess do not manage connect() at time, opening a 74 # backdoor then :\ 75 foreach ($sync->bases) { $_->{_user} = $c->user->{username} } 76 77 my $suser = $sync->get_object('user', $username); 78 my $msg = $c->stash->{user}->check_password($c->req->param('passwd')); 79 if ($msg ne 'ok') { 80 $c->stash->{pmerror} = $msg . ', mot de passe inchangé'; 81 } elsif ($suser && $suser->set_password($c->req->param('passwd'))) { 82 $c->stash->{pmerror} = 'Mot de passe changé'; 83 $sync->commit; 84 } else { 85 $c->stash->{pmerror} = 'Erreur lors du changement de mot de passe'; 86 } 99 $c->stash->{pmerror} = $c->forward('change_password', 100 [ $username, $c->req->param('passwd') ] ) || 'Mot de passe changé'; 87 101 } else { 88 102 $c->stash->{pmerror} = 'Mot de passe différents';
Note: See TracChangeset
for help on using the changeset viewer.