diff --git a/admin/user.php b/admin/user.php
index 216906ccf4d..a0dbb506556 100644
--- a/admin/user.php
+++ b/admin/user.php
@@ -71,14 +71,10 @@
             print_error('alreadyconfirmed');
         }
 
-        $returnmsg = get_string('emailconfirmsentsuccess');
-        $messagetype = \core\output\notification::NOTIFY_SUCCESS;
-        if (!send_confirmation_email($user)) {
-            $returnmsg = get_string('emailconfirmsentfailure');
-            $messagetype = \core\output\notification::NOTIFY_ERROR;
-        }
+        $auth = get_auth_plugin($user->auth);
+
+        $auth->user_resend_confirmation($user->username);
 
-        redirect($returnurl, $returnmsg, null, $messagetype);
     } else if ($delete and confirm_sesskey()) {              // Delete a selected user, after confirmation
         require_capability('moodle/user:delete', $sitecontext);
 
@@ -383,12 +379,16 @@
                     $lastcolumn = "<span class=\"dimmed_text\">".get_string('confirm')."</span>";
                 }
 
-                $lastcolumn .= ' | ' . html_writer::link(new moodle_url($returnurl,
-                    [
-                        'resendemail' => $user->id,
-                        'sesskey' => sesskey()
-                    ]
-                ), $strresendemail);
+                $auth = get_auth_plugin($user->auth);
+
+                if ($auth->can_resend_confirmation()) {
+                    $lastcolumn .= ' | ' . html_writer::link(new moodle_url($returnurl,
+                        [
+                            'resendemail' => $user->id,
+                            'sesskey' => sesskey()
+                        ]
+                    ), $strresendemail);
+                }
             }
 
             if ($user->lastaccess) {
diff --git a/auth/email/auth.php b/auth/email/auth.php
index f207f030a22..71b19778d40 100644
--- a/auth/email/auth.php
+++ b/auth/email/auth.php
@@ -155,6 +155,32 @@ class auth_plugin_email extends auth_plugin_base {
         }
     }
 
+    /**
+     * Returns true if plugin allows resending confirmation of new users.
+     *
+     * @return bool
+     */
+    function can_resend_confirmation() {
+        return true;
+    }
+
+    /**
+     * Resend confirmation email for the new user.
+     *
+     * @param string $username
+     */
+    function user_resend_confirmation($username) {
+        $returnmsg = get_string('emailconfirmsentfailure');
+        $messagetype = \core\output\notification::NOTIFY_ERROR;
+        if ($user->secret == $confirmsecret) {   // They have provided the secret key to get in
+            if (!send_confirmation_email($user)) {
+                $returnmsg = get_string('emailconfirmsentsuccess');
+                $messagetype = \core\output\notification::NOTIFY_SUCCESS;
+            }
+        }
+        redirect($returnurl, $returnmsg, null, $messagetype);
+    }
+
     /**
      * Returns true if plugin allows confirming of new users.
      *
diff --git a/lib/authlib.php b/lib/authlib.php
index 9bfa0fffb2c..e7e61a15e58 100644
--- a/lib/authlib.php
+++ b/lib/authlib.php
@@ -338,6 +338,26 @@ class auth_plugin_base {
         print_error('mustbeoveride', 'debug', '', 'user_confirm()' );
     }
 
+    /**
+     * Returns true if plugin allows resending confirmation of new users.
+     *
+     * @return bool
+     */
+    function can_resend_confirmation() {
+        //override if needed
+        return false;
+    }
+
+    /**
+     * Resend user confirmation email.
+     *
+     * @param string $username
+     */
+    function user_resend_confirmation($username) {
+        //override when can confirm
+        print_error('mustbeoveride', 'debug', '', 'user_resend_confirmation()' );
+    }
+
     /**
      * Checks if user exists in external db
      *
diff --git a/lib/datalib.php b/lib/datalib.php
index 52946fa5683..8079acd83fe 100644
--- a/lib/datalib.php
+++ b/lib/datalib.php
@@ -522,7 +522,7 @@ function get_users_listing($sort='lastaccess', $dir='ASC', $page=0, $recordsperp
     $extrafields = "$extrafields, $namefields";
 
     // warning: will return UNCONFIRMED USERS
-    return $DB->get_records_sql("SELECT id, username, email, city, country, lastaccess, confirmed, mnethostid, suspended $extrafields
+    return $DB->get_records_sql("SELECT id, username, email, city, country, lastaccess, confirmed, mnethostid, suspended, auth $extrafields
                                    FROM {user}
                                   WHERE $select
                                   $sort", $params, $page, $recordsperpage);
diff --git a/login/index.php b/login/index.php
index 7f6656026ab..441cb47c93b 100644
--- a/login/index.php
+++ b/login/index.php
@@ -186,22 +186,29 @@ if ($frm and isset($frm->username)) {                             // Login WITH
             $PAGE->set_heading($site->fullname);
             echo $OUTPUT->header();
             echo $OUTPUT->heading(get_string("mustconfirm"));
-            if ($resendconfirmemail) {
-                if (!send_confirmation_email($user)) {
-                    echo $OUTPUT->notification(get_string('emailconfirmsentfailure'), \core\output\notification::NOTIFY_ERROR);
-                } else {
-                    echo $OUTPUT->notification(get_string('emailconfirmsentsuccess'), \core\output\notification::NOTIFY_SUCCESS);
+            $userauth = get_auth_plugin($user->auth);
+            $resendmsg = $OUTPUT->box(get_string("emailconfirmsent", "", s($user->email)), "generalbox boxaligncenter");
+            if ($userauth->can_resend_confirmation()) {
+                if ($resendconfirmemail) {
+                    if (!send_confirmation_email($user)) {
+                        echo $OUTPUT->notification(get_string('emailconfirmsentfailure'), \core\output\notification::NOTIFY_ERROR);
+                    } else {
+                        echo $OUTPUT->notification(get_string('emailconfirmsentsuccess'), \core\output\notification::NOTIFY_SUCCESS);
+                    }
                 }
+                echo $resendmsg;
+                $resendconfirmurl = new moodle_url('/login/index.php',
+                    [
+                        'username' => $frm->username,
+                        'password' => $frm->password,
+                        'resendconfirmemail' => true,
+                        'logintoken' => \core\session\manager::get_login_token()
+                    ]
+                );
+                echo $OUTPUT->single_button($resendconfirmurl, get_string('emailconfirmationresend'));
+            } else {
+                echo $resendmsg;
             }
-            echo $OUTPUT->box(get_string("emailconfirmsent", "", s($user->email)), "generalbox boxaligncenter");
-            $resendconfirmurl = new moodle_url('/login/index.php',
-                [
-                    'username' => $frm->username,
-                    'password' => $frm->password,
-                    'resendconfirmemail' => true
-                ]
-            );
-            echo $OUTPUT->single_button($resendconfirmurl, get_string('emailconfirmationresend'));
             echo $OUTPUT->footer();
             die;
         }
