jonmbake / discourse-ldap-auth

Discourse plugin to enable LDAP/Active Directory authentication.
MIT License
70 stars 53 forks source link

edit login page #61

Open krojowska opened 3 years ago

krojowska commented 3 years ago

obraz Where I can change and edit this page? I want to add regulations for users on this page.

Please help

jonmbake commented 3 years ago

I believe the login form is defined via omniauth: https://github.com/omniauth/omniauth/blob/a62d36b3f847e0e55b077790112e96950c35085a/lib/omniauth/form.rb

felagund commented 1 year ago

This is a duplicate of this: https://github.com/jonmbake/discourse-ldap-auth/issues/28

But as far as I can tell, there is no straightforward way to add anything to this page ( I would like to add a link for users to reset their password).

felagund commented 1 year ago

So, apparently one could customize it:

You can insert whatever html you want using the OmniAuth::Form#html method.

Here's where your LDAP strategy is building its form.

I'm not sure how you'd manage all the inner workings using jonmbake/discourse-ldap-auth, but using an omniauth strategy you'd

class Omniauth::Strategies::MyCustomLDAP < Omniauth::Strategies::LDAP
  def request_phase
    OmniAuth::LDAP::Adaptor.validate @options
    f = OmniAuth::Form.new(:title => (options[:title] || "LDAP Authentication"), :url => callback_path)
    f.text_field 'Login', 'username'
    f.password_field 'Password', 'password'
    f.button "Sign In"
    f.html '<a href="https://my-password-reset-url.com">Reset Password</a>'
    f.to_response
  end
end

However, I do not know ruby so I am not sure where to put anything :-(.