Changeset 2006 for trunk/LATMOS-Accounts-Web
- Timestamp:
- 04/28/17 10:54:50 (7 years ago)
- Location:
- trunk/LATMOS-Accounts-Web
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Tools/LoadPasswd.pm
r2003 r2006 2 2 use Moose; 3 3 use namespace::autoclean; 4 5 use LATMOS::Accounts::Log; 4 6 5 7 BEGIN { extends 'Catalyst::Controller'; } … … 25 27 my ( $self, $c ) = @_; 26 28 27 my $account = $c->model('Account ');29 my $account = $c->model('Accounts'); 28 30 29 31 if (my $upload = $c->req->upload('input')) { 30 32 31 33 my $crypt = $c->req->param('crypt'); 34 my $force = $c->req->param('force'); 32 35 33 36 my $fh = $upload->fh; 34 37 while (my $line = <$fh>) { 35 my ($username, $password) = split(/:/ );38 my ($username, $password) = split(/:/, $line); 36 39 $username or next; 37 40 $password or next; 38 41 39 42 if ($crypt) { 40 my $user = $c->model('Accounts')->db->get_objects('user', $username) 41 or next; 42 $user->InjectCryptPasswd($password); 43 my $user = $account->db->get_objects('user', $username) 44 or do { 45 push(@{ $c->stash->{Pass} }, { u => $username, r => 'No such user' }); 46 next; 47 }; 48 $account->db->check_acl($user, 'userPassword', 'w') 49 or do { 50 push(@{ $c->stash->{Pass} }, { u => $username, r => 'Permission denied' }); 51 next; 52 }; 53 54 if ($user->InjectCryptPasswd($password)) { 55 push(@{ $c->stash->{Pass} }, { u => $username, r => 'Injected' }); 56 } else { 57 push(@{ $c->stash->{Pass} }, { u => $username, r => 'Error: ' . LATMOS::Accounts::Log::lastmessage(LA_ERR) }); 58 } 43 59 } else { 44 $c->model('Accounts')->ChangeUserPassword($username, $password); 60 my $message = $account->ChangeUserPassword($username, $password, $force); 61 push(@{ $c->stash->{Pass} }, { u => $username, r => $message || 'Changed' }); 45 62 } 46 63 } 47 64 } 48 65 } 49 50 51 66 52 67 =encoding utf8 -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/I18N/fr.po
r1993 r2006 46 46 msgstr "(autre)" 47 47 48 #: root/html/includes/sidebar.tt: 9448 #: root/html/includes/sidebar.tt:104 49 49 msgid "About" 50 50 msgstr "à propos" … … 125 125 msgstr "Départ" 126 126 127 #: root/html/includes/sidebar.tt:97 128 msgid "Load Password" 129 msgstr "" 130 127 131 #: root/html/includes/sidebar.tt:20 128 132 msgid "Logout" … … 139 143 #: root/html/tools/csv/parseCSV.tt:24 140 144 msgid "Object Name" 145 msgstr "" 146 147 #: root/html/tools/loadnew/index.tt:22 148 msgid "Object data:" 149 msgstr "" 150 151 #: root/html/tools/loadnew/index.tt:17 152 msgid "Object name (optional):" 141 153 msgstr "" 142 154 … … 213 225 msgstr "Aujourd'hui" 214 226 227 #: root/html/includes/sidebar.tt:93 228 msgid "Tools" 229 msgstr "Outils" 230 215 231 #: root/html/tools/csv/index.tt:21 216 232 msgid "Type of object to create" 233 msgstr "" 234 235 #: root/html/tools/loadnew/index.tt:4 236 msgid "Type of object to create:" 217 237 msgstr "" 218 238 … … 230 250 msgstr "Bienvenue %1." 231 251 252 #: root/html/tools/loadnew/index.tt:23 253 msgid "You can load a existing file..." 254 msgstr "" 255 232 256 #. (c.stash.accountExists) 233 257 #: root/html/about/index.tt:5 … … 240 264 msgstr "Votre compte exprirera dans %1, Nous vraiment désolé." 241 265 266 #: root/html/tools/loadnew/index.tt:27 267 msgid "or paste the content here:" 268 msgstr "" 269 242 270 #: root/html/users/employment.tt:29 root/html/users/employment.tt:92 243 271 msgid "to" … … 247 275 #~ msgid "From CVS" 248 276 #~ msgstr "Du" 249 250 #~ msgid "Tools"251 #~ msgstr "Outils" -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/I18N/messages.pot
r1993 r2006 39 39 msgstr "" 40 40 41 #: root/html/includes/sidebar.tt: 9441 #: root/html/includes/sidebar.tt:104 42 42 msgid "About" 43 43 msgstr "" … … 115 115 msgstr "" 116 116 117 #: root/html/includes/sidebar.tt:97 118 msgid "Load Password" 119 msgstr "" 120 117 121 #: root/html/includes/sidebar.tt:20 118 122 msgid "Logout" … … 129 133 #: root/html/tools/csv/parseCSV.tt:24 130 134 msgid "Object Name" 135 msgstr "" 136 137 #: root/html/tools/loadnew/index.tt:22 138 msgid "Object data:" 139 msgstr "" 140 141 #: root/html/tools/loadnew/index.tt:17 142 msgid "Object name (optional):" 131 143 msgstr "" 132 144 … … 201 213 msgstr "" 202 214 215 #: root/html/includes/sidebar.tt:93 216 msgid "Tools" 217 msgstr "" 218 203 219 #: root/html/tools/csv/index.tt:21 204 220 msgid "Type of object to create" 221 msgstr "" 222 223 #: root/html/tools/loadnew/index.tt:4 224 msgid "Type of object to create:" 205 225 msgstr "" 206 226 … … 218 238 msgstr "" 219 239 240 #: root/html/tools/loadnew/index.tt:23 241 msgid "You can load a existing file..." 242 msgstr "" 243 220 244 #. (c.stash.accountExists) 221 245 #: root/html/about/index.tt:5 … … 228 252 msgstr "" 229 253 254 #: root/html/tools/loadnew/index.tt:27 255 msgid "or paste the content here:" 256 msgstr "" 257 230 258 #: root/html/users/employment.tt:29 root/html/users/employment.tt:92 231 259 msgid "to" -
trunk/LATMOS-Accounts-Web/root/html/includes/sidebar.tt
r1993 r2006 91 91 </li> 92 92 93 <li>[% l('Tools') %] 94 <ul> 95 [% IF c.model('Accounts').db.check_acl('user', 'userPasswd', 'w') %] 96 <li><a href="[% c.uri_for('/tools', 'loadpasswd') %]"> 97 [% l('Load Password') %] 98 </a></li> 99 [% END %] 100 </ul> 101 </li> 102 93 103 <li><a href="[% c.uri_for('/about') %]"> 94 104 [% l('About') %]</a></li> -
trunk/LATMOS-Accounts-Web/root/html/tools/loadpasswd/index.tt
r2003 r2006 1 1 <form action="[% c.uri_for('/tools', 'loadpasswd') %]" method="post" 2 2 enctype="multipart/form-data"> 3 4 <p>[% l('The file format must similar to UNIX standard password, only the two 5 first column are used.') %]</p> 6 7 <pre> 8 username1:password1:.... 9 username2:password2:.... 10 </pre> 3 11 4 12 <p>[% l('When password are encrypted they are injected only in … … 8 16 <input type=checkbox name=crypt> 9 17 <br> 18 <label for=crypt>[% l('Dont check for weak passord') | html %]</label> 19 <input type=checkbox name=force> 20 <br> 10 21 <label for=file>[% l('You can load a existing file...') | html %]</label> 11 22 <br> … … 14 25 <input type="submit"> 15 26 </form> 27 28 [% FOREACH res = Pass %] 29 [% IF loop.first %] 30 <p>[% l('Results:') %]</p> 31 <table border=1> 32 <tr> 33 <td>[% l('Username') | html %]</td> 34 <td>[% l('Results') | html %]</td> 35 </tr> 36 [% END %] 37 <tr> 38 <td>[% res.u | html %]</td> 39 <td>[% res.r | html %]</td> 40 </tr> 41 [% IF loop.last %] 42 </table> 43 [% END %] 44 [% END %]
Note: See TracChangeset
for help on using the changeset viewer.