diff --git a/login/change_password.php b/login/change_password.php
index <HASH>..<HASH> 100644
--- a/login/change_password.php
+++ b/login/change_password.php
@@ -29,6 +29,7 @@
 
 			$USER = $user;
 			$USER->loggedin = true;
+            $USER->site = $CFG->wwwroot;   // for added security
             save_session("USER");
 
 			set_moodle_cookie($USER->username);
Make sure site security is added when logging in via change password