Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
0b479750
Commit
0b479750
authored
May 05, 2011
by
Francois Marier
Committed by
Gerrit Code Review
May 05, 2011
Browse files
Merge "Add optional reset of the passwordchange field (bug #775221)"
parents
efc32588
e21213ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/admin/users/uploadcsv.php
View file @
0b479750
...
...
@@ -351,7 +351,7 @@ function uploadcsv_submit(Pieform $form, $values) {
$userobj
=
$userobj
->
find_by_id
(
$user
->
id
);
$authobj_tmp
=
AuthFactory
::
create
(
$user
->
authinstance
);
if
(
method_exists
(
$authobj_tmp
,
'change_password'
))
{
$authobj_tmp
->
change_password
(
$userobj
,
$user
->
password
);
$authobj_tmp
->
change_password
(
$userobj
,
$user
->
password
,
false
);
}
else
{
$userobj
->
password
=
''
;
$userobj
->
salt
=
auth_get_random_salt
();
...
...
htdocs/auth/internal/lib.php
View file @
0b479750
...
...
@@ -102,14 +102,17 @@ class AuthInternal extends Auth {
*
* @param object $user The user to change the password for
* @param string $password The password to set for the user
* @param boolean $resetpasswordchange Whether to reset the passwordchange variable or not
* @return string The new password, or empty if the password could not be set
*/
public
function
change_password
(
User
$user
,
$password
)
{
public
function
change_password
(
User
$user
,
$password
,
$resetpasswordchange
=
true
)
{
$this
->
must_be_ready
();
// Create a salted password and set it for the user
$user
->
salt
=
substr
(
md5
(
rand
(
1000000
,
9999999
)),
2
,
8
);
$user
->
password
=
$this
->
encrypt_password
(
$password
,
$user
->
salt
);
$user
->
passwordchange
=
0
;
if
(
$resetpasswordchange
)
{
$user
->
passwordchange
=
0
;
}
$user
->
commit
();
return
$user
->
password
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment