diff --git a/social_login.module b/social_login.module
index 4619e70..4bde703 100644
--- a/social_login.module
+++ b/social_login.module
@@ -771,7 +771,7 @@ function social_login_link_social_network_avatar($social_data, $account) {
         // Save the picture data locally.
         $tmp_name = $file_base_name . '.tmp';
         $tmp_path = \Drupal::service('stream_wrapper_manager')->normalizeUri($tmp_name);
-        $tmp_file = file_save_data($http_result['http_data'], $tmp_path, FileSystemInterface::EXISTS_REPLACE);
+        $tmp_file = \Drupal::service('file.repository')->writeData($http_result['http_data'], $tmp_path, FileSystemInterface::EXISTS_REPLACE);
 
         if ($tmp_file === FALSE) {
           Drupal::logger('social_login')->error('Could not save user avatar to @path', ['@path' => $tmp_path]);
@@ -786,7 +786,7 @@ function social_login_link_social_network_avatar($social_data, $account) {
           $real_name = $file_base_name . image_type_to_extension($type);
           $real_path = \Drupal::service('stream_wrapper_manager')->normalizeUri($real_name);
 
-          $real_file = file_move($tmp_file, $real_path, FileSystemInterface::EXISTS_REPLACE);
+          $real_file = \Drupal::service('file.repository')->move($tmp_file, $real_path, FileSystemInterface::EXISTS_REPLACE);
 
           // file_move does not update the destination filename:
           $real_file->setFilename(Drupal::service('file_system')->basename($real_path));
diff --git a/src/Controller/SocialLoginController.php b/src/Controller/SocialLoginController.php
index 1c54b7c..dc0eb7d 100644
--- a/src/Controller/SocialLoginController.php
+++ b/src/Controller/SocialLoginController.php
@@ -403,7 +403,7 @@ class SocialLoginController extends ControllerBase {
                       }
 
                       // Forge password.
-                      $user_password = user_password(8);
+                      $user_password = \Drupal::service('password_generator')->generate(8);
 
                       // Check the approval setting.
                       switch ($registration_approval) {
