MDL-48282 Standardise update of user->firstaccess
authorPetr Skoda <petr.skoda@totaralms.com>
Wed, 19 Nov 2014 01:16:41 +0000 (14:16 +1300)
committerPetr Skoda <petr.skoda@totaralms.com>
Thu, 20 Nov 2014 20:25:57 +0000 (09:25 +1300)
auth/email/auth.php
auth/ldap/auth.php
auth/manual/auth.php
auth/mnet/auth.php
auth/upgrade.txt
login/signup.php

index 2c36eab..8ab97ae 100644 (file)
@@ -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 {
index b77c305..f80ab19 100644 (file)
@@ -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;
             }
index 0b014bb..938aae8 100644 (file)
@@ -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  {
index ef3d1fc..f061539 100644 (file)
@@ -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) {
index 5308808..0c6d453 100644 (file)
@@ -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
index 990a9e9..976b342 100644 (file)
@@ -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);