]> git.openstreetmap.org Git - rails.git/commitdiff
Hash passwords as soon as a new user is created
authorTom Hughes <tom@compton.nu>
Thu, 16 Nov 2023 00:54:56 +0000 (00:54 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 16 Nov 2023 01:02:11 +0000 (01:02 +0000)
.rubocop_todo.yml
app/controllers/users_controller.rb
app/models/user.rb

index 6f25cfeb3333abeec57378ca3a7c1d123ca6f5d1..e3407c6dc0111d811f1b34377429a46d63a2d14a 100644 (file)
@@ -61,7 +61,7 @@ Metrics/BlockNesting:
 # Offense count: 26
 # Configuration parameters: CountComments, CountAsOne.
 Metrics/ClassLength:
-  Max: 285
+  Max: 286
 
 # Offense count: 59
 # Configuration parameters: AllowedMethods, AllowedPatterns.
index 0b8cab6ddbbe0a09106031376f5cfced9c0b6b5a..36c9f4e2288f06185726045826ae82ed9d927bb0 100644 (file)
@@ -104,11 +104,11 @@ class UsersController < ApplicationController
         render :action => "new"
       elsif current_user.auth_provider.present?
         # Verify external authenticator before moving on
-        session[:new_user] = current_user.attributes.slice("email", "display_name", "pass_crypt", "pass_crypt_confirmation")
+        session[:new_user] = current_user.attributes.slice("email", "display_name", "pass_crypt")
         redirect_to auth_url(current_user.auth_provider, current_user.auth_uid), :status => :temporary_redirect
       else
         # Save the user record
-        session[:new_user] = current_user.attributes.slice("email", "display_name", "pass_crypt", "pass_crypt_confirmation")
+        session[:new_user] = current_user.attributes.slice("email", "display_name", "pass_crypt")
         redirect_to :action => :terms
       end
     end
index 3d74b3933ec2c7eaabdf49585ff8ba0206b8fa0d..7571dd9dc5c8011f4615ebf970b6f0daa377adc9 100644 (file)
@@ -115,6 +115,7 @@ class User < ApplicationRecord
 
   alias_attribute :created_at, :creation_time
 
+  after_initialize :encrypt_password
   before_save :encrypt_password
   before_save :update_tile
   after_save :spam_check