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
|
# 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.14
|
# version: 0.16
|
||||||
# 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
|
||||||
|
|
||||||
@ -13,9 +13,12 @@
|
|||||||
# enabled_site_setting :legacymd5password_auth_enabled
|
# enabled_site_setting :legacymd5password_auth_enabled
|
||||||
|
|
||||||
after_initialize do
|
after_initialize do
|
||||||
# Extend the SessionController class to include our custom authentication logic
|
# Define a module to hold the legacy MD5 authentication logic
|
||||||
class ::SessionController
|
module LegacyMd5Authentication
|
||||||
prepend Module.new {
|
|
||||||
|
# Constants
|
||||||
|
ITOA64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||||
|
|
||||||
# Override the create method to add our custom authentication checks
|
# Override the create method to add our custom authentication checks
|
||||||
def create
|
def create
|
||||||
Rails.logger.warn "MD5 -- AA -- start create"
|
Rails.logger.warn "MD5 -- AA -- start create"
|
||||||
@ -126,9 +129,6 @@ after_initialize do
|
|||||||
not_activated(user)
|
not_activated(user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Helper methods to handle MD5 password verification
|
# 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 = gossamer_md5_crypt(password, legacy_hash)
|
||||||
generated_hash == legacy_hash
|
generated_hash == legacy_hash
|
||||||
end
|
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