Changeset 55 for LATMOS-Accounts
- Timestamp:
- 04/26/09 17:46:06 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm
r42 r55 189 189 } 190 190 191 =head2 set_password($password) 192 193 Set the password into the database, $password is the clear version 194 of the password. 195 196 This function store it into userPassword canonical field if supported 197 using crypt unix and md5 algorythm (crypt md5), the salt is 8 random 198 caracters. 199 200 The base driver should override it if another encryption is need. 201 202 =cut 203 204 sub set_password { 205 my ($self, $clear_pass) = @_; 206 if (my $field = $self->base->get_field_name($self->type, 'userPassword')) { 207 my @salt_char = (('a' .. 'z'), ('A' .. 'Z'), (0 .. 9), '/', '.'); 208 my $salt = join('', map { $salt_char[rand(scalar(@salt_char))] } (1 .. 8)); 209 $self->set_field($field, crypt($clear_pass, $salt)); 210 } 211 } 212 191 213 1; 192 214
Note: See TracChangeset
for help on using the changeset viewer.