Add external change password link

(thecellmc) #1

I am using Discourse with a WordPress website where WordPress is the SSO provider.
As WordPress is the SSO provider, you can’t change your password within the Discourse user settings.
Would it be possible to add a button, in the Account settings, which links to my main website to that the user can change his password?
Here is a mockup of what I would like to have:

So any ideas about how this would be possible?

(cpradio) #2

This isn’t below, but would appear above all of the preference pages, and it is what we use for our SSO scenario (I should really turn this into a #howto)

(thecellmc) #3

Thanks for your help.
I actually found a way to solve my issue myself.
I edited the account.hbs file in the password settings to this:

<div class="control-group pref-password">
  <label class="control-label">{{i18n 'user.password.title'}}</label>
  <div class="controls">
    <a href href="" class='btn'>
      {{fa-icon "key"}}
      Change Password

(cpradio) #4

Hmmm… I’m not 100% sure that setting/template should be loaded when SSO is enabled, so overriding it might not do anything. I know on our Production instance (which isn’t latest), we do not see the Change Password field/setting in our User Preferences.

cc @neil

(thecellmc) #5

@cpradio I removed the lines which hide the password field when SSO is enabled.
They are also located in the account.hbs file.

(Joshua Rosenfeld) #6

From your posts it sounds like you edited files directly - please don’t do that! 1, if you edited them via the ssh they will simply be overwritten upon the next update. 2, if you edited them in a way that replaced the files upon each update, your going to break something. Please be sure to make changes to Discourse via customizations in /admin or via a plugin.

(Neil Lalonde) #7

The account.hbs template will be shown even if SSO is enabled. The fields might not be editable (depending on your settings), but you’ll be able to see their values.