v0.17 Yet another fixup to work with Bitnami Discourse 3.2.5 - password_expired? not supported
This commit is contained in:
		
							
								
								
									
										16
									
								
								plugin.rb
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								plugin.rb
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# name: discourse-md5_authentication
 | 
					# name: discourse-md5_authentication
 | 
				
			||||||
# about: A plugin to authenticate users with MD5 passwords from legacy systems
 | 
					# about: A plugin to authenticate users with MD5 passwords from legacy systems
 | 
				
			||||||
# version: 0.16
 | 
					# version: 0.17
 | 
				
			||||||
# authors: saint@federated.computer
 | 
					# authors: saint@federated.computer
 | 
				
			||||||
# url: https://gitea.federated.computer/saint/discourse-md5_authentication.git
 | 
					# url: https://gitea.federated.computer/saint/discourse-md5_authentication.git
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -102,13 +102,13 @@ after_initialize do
 | 
				
			|||||||
        # Invalidate any invite link for the user
 | 
					        # Invalidate any invite link for the user
 | 
				
			||||||
        Invite.invalidate_for_email(user.email)
 | 
					        Invite.invalidate_for_email(user.email)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Check if the user's password has expired
 | 
					# 3.3.0        # Check if the user's password has expired
 | 
				
			||||||
        if user.password_expired?(password)
 | 
					#        if user.password_expired?(password)
 | 
				
			||||||
          render json: { error: "expired", reason: "expired" }
 | 
					#          render json: { error: "expired", reason: "expired" }
 | 
				
			||||||
          return
 | 
					#          return
 | 
				
			||||||
        end
 | 
					#        end
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        # If no user is found with the provided credentials
 | 
					        # No user is found with the provided credentials
 | 
				
			||||||
        invalid_credentials
 | 
					        invalid_credentials
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
@@ -213,6 +213,8 @@ after_initialize do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Extend the SessionController class to include the LegacyMd5Authentication module
 | 
					  # Extend the SessionController class to include the LegacyMd5Authentication module
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 3.3.0   class ::SessionController < ApplicationController
 | 
				
			||||||
  class ::SessionController
 | 
					  class ::SessionController
 | 
				
			||||||
    prepend LegacyMd5Authentication
 | 
					    prepend LegacyMd5Authentication
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user