v0.16 Further fixups to work with Bitnami Discourse 3.2.5
This commit is contained in:
parent
9edabc2a3a
commit
7226bf0b9a
BIN
.plugin.rb.bck.swp
Normal file
BIN
.plugin.rb.bck.swp
Normal file
Binary file not shown.
22
plugin.rb
22
plugin.rb
@ -4,7 +4,7 @@
|
||||
|
||||
# name: discourse-md5_authentication
|
||||
# about: A plugin to authenticate users with MD5 passwords from legacy systems
|
||||
# version: 0.14
|
||||
# version: 0.16
|
||||
# authors: saint@federated.computer
|
||||
# url: https://gitea.federated.computer/saint/discourse-md5_authentication.git
|
||||
|
||||
@ -13,9 +13,12 @@
|
||||
# enabled_site_setting :legacymd5password_auth_enabled
|
||||
|
||||
after_initialize do
|
||||
# Extend the SessionController class to include our custom authentication logic
|
||||
class ::SessionController
|
||||
prepend Module.new {
|
||||
# Define a module to hold the legacy MD5 authentication logic
|
||||
module LegacyMd5Authentication
|
||||
|
||||
# Constants
|
||||
ITOA64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
# Override the create method to add our custom authentication checks
|
||||
def create
|
||||
Rails.logger.warn "MD5 -- AA -- start create"
|
||||
@ -126,9 +129,6 @@ after_initialize do
|
||||
not_activated(user)
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Helper methods to handle MD5 password verification
|
||||
|
||||
@ -210,3 +210,11 @@ def verify_gossamer_password(password, legacy_hash)
|
||||
generated_hash = gossamer_md5_crypt(password, legacy_hash)
|
||||
generated_hash == legacy_hash
|
||||
end
|
||||
end
|
||||
|
||||
# Extend the SessionController class to include the LegacyMd5Authentication module
|
||||
class ::SessionController
|
||||
prepend LegacyMd5Authentication
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user