locked
ADDING CHANGE PASSWORD TO CUSTOM SHELL RRS feed

  • Question

  • Hi all, i have been working on a default theme which i wanted to add the capability of changing password in forms authentication. I wanted to reuse the default change password dialog which i have managed to show using the code below:

                <DefaultShell:CurrentUserComboBox x:Name="CurrUser" ShellHelpers:ComponentViewModelService.ViewModelName="Default.CurrentUserViewModel" Grid.Column="2">
                    <ComboBoxItem Name="sdr" Content="{Binding CurrentUserDisplayName, Converter={StaticResource CurrentUserConverter}}" IsSelected="True"/>
                    <Button Content="Change password" Click="ChangePwd_Click" BorderThickness="0" Opacity="100"/>
                </DefaultShell:CurrentUserComboBox>

    I am looking for a way to access loged in user, and change the password when the user presses  'ok' on the change password dialog.

    Any help will be much appreciated


    private



    • Edited by Kilonzo Thursday, February 18, 2016 11:52 AM
    Wednesday, February 10, 2016 5:11 PM

All replies

  • Hi Kilonzo,

    According to your description, you want to implement change password for current loged in user, is it right?

    Please refer to below thread which is similiar with your requirement. Hope it can help you.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/535dba19-ac97-4909-a49f-62b109c287fd/reset-recover-password-in-lightswitch-form-auth?forum=lightswitch

    Best Regards,
    Weiwei

    Monday, February 15, 2016 1:14 PM
    Moderator
  • Yea, it is changing password for the current user. In this case, i have developed a custom shell. There is the CurrentUserComboBox that you use on the standard shell to change password for currently logged in user. I want to use the same combobox in my application. As you see from the code above, i have managed to show it up in the application. The problem is that when i input new password and press ok, nothing happens. I need to know how to implement that code on the shell level.

    Thanks


    private

    Tuesday, February 16, 2016 5:36 AM
  • Hi Kilonzo,

    Could you please share a sample project about how do you implement the function of change password in your project? I think there may be something wrong with your code-behind of button.

    First, we need to get current user with below code.

    IUser user = this.Application.User;

    Then you can get the user login information from database and modify it based on your requirement.

    Best Regards,
    Weiwei

    Tuesday, February 16, 2016 8:37 AM
    Moderator
  • Hi Weiwei,

    Sorry I was away yesterday. Below is the code for calling the changepasswordBox:

            private void ChangePwd_Click(object sender, RoutedEventArgs e)
            {
                ChangePasswordDialog ChangePWD = new ChangePasswordDialog();
                ChangePWD.Show();
            }


    Inthe shell, i have added the place for change password button which is inside the combobox. The button's code is the one listed above.

    Then, below is the default dialog which opens when you click on the Change password button above:

    Change password dialog

    As you can see, the dialog is the Standard shell dialog for changing the password. 

    I only managed to show the dialog, but not changing the user's password. Remember that this is done on the shell level


    private



    • Edited by Kilonzo Thursday, February 18, 2016 11:50 AM Clarification
    Thursday, February 18, 2016 11:30 AM
  • I think you should share a sample project which can help us debug your code and find out the problem quickly.
    Friday, February 19, 2016 8:49 AM
  • Hi,

    Here is a link to the shell project:

    https://drive.google.com/file/d/0B-0I4Z1N-1zlRzA3ZFNkRnhJVXM/view?usp=sharing


    private

    Friday, February 19, 2016 10:36 AM