From f720c2c060fa20a2e46e55b772feab4dfe10df6a Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Wed, 19 Nov 2014 14:16:41 +1300 Subject: [PATCH] MDL-48282 Standardise update of user->firstaccess --- auth/email/auth.php | 3 --- auth/ldap/auth.php | 3 --- auth/manual/auth.php | 3 --- auth/mnet/auth.php | 5 +---- auth/upgrade.txt | 4 ++++ login/signup.php | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/auth/email/auth.php b/auth/email/auth.php index 2c36eabcb33..8ab97aecf54 100644 --- a/auth/email/auth.php +++ b/auth/email/auth.php @@ -147,9 +147,6 @@ class auth_plugin_email extends auth_plugin_base { } else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in $DB->set_field("user", "confirmed", 1, array("id"=>$user->id)); - if ($user->firstaccess == 0) { - $DB->set_field("user", "firstaccess", time(), array("id"=>$user->id)); - } return AUTH_CONFIRM_OK; } } else { diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index b77c305fcea..f80ab19c17d 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -615,9 +615,6 @@ class auth_plugin_ldap extends auth_plugin_base { return AUTH_CONFIRM_FAIL; } $user->confirmed = 1; - if ($user->firstaccess == 0) { - $user->firstaccess = time(); - } user_update_user($user, false); return AUTH_CONFIRM_OK; } diff --git a/auth/manual/auth.php b/auth/manual/auth.php index 0b014bbedea..938aae8f6fb 100644 --- a/auth/manual/auth.php +++ b/auth/manual/auth.php @@ -233,9 +233,6 @@ class auth_plugin_manual extends auth_plugin_base { return AUTH_CONFIRM_ALREADY; } else { $DB->set_field("user", "confirmed", 1, array("id"=>$user->id)); - if ($user->firstaccess == 0) { - $DB->set_field("user", "firstaccess", time(), array("id"=>$user->id)); - } return AUTH_CONFIRM_OK; } } else { diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index ef3d1fc89f5..f0615398630 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -289,7 +289,7 @@ class auth_plugin_mnet extends auth_plugin_base { } See MDL-21327 for why this is commented out */ $remoteuser->mnethostid = $remotehost->id; - $remoteuser->firstaccess = time(); // First time user in this server, grab it here + $remoteuser->firstaccess = 0; $remoteuser->confirmed = 1; $remoteuser->id = $DB->insert_record('user', $remoteuser); @@ -359,9 +359,6 @@ class auth_plugin_mnet extends auth_plugin_base { } $localuser->mnethostid = $remotepeer->id; - if (empty($localuser->firstaccess)) { // Now firstaccess, grab it here - $localuser->firstaccess = time(); - } user_update_user($localuser, false); if (!$firsttime) { diff --git a/auth/upgrade.txt b/auth/upgrade.txt index 5308808806b..0c6d4535ae6 100644 --- a/auth/upgrade.txt +++ b/auth/upgrade.txt @@ -1,6 +1,10 @@ This files describes API changes in /auth/* - plugins, information provided here is intended especially for developers. +=== 2.9 === + +* Do not update user->firstaccess from any auth plugin, the complete_user_login() does it automatically. + === 2.8 === * \core\session\manager::session_exists() now verifies the session is active diff --git a/login/signup.php b/login/signup.php index 990a9e94b80..976b3420f87 100644 --- a/login/signup.php +++ b/login/signup.php @@ -56,7 +56,7 @@ if ($mform_signup->is_cancelled()) { } else if ($user = $mform_signup->get_data()) { $user->confirmed = 0; $user->lang = current_language(); - $user->firstaccess = time(); + $user->firstaccess = 0; $user->timecreated = time(); $user->mnethostid = $CFG->mnet_localhost_id; $user->secret = random_string(15);