StrataFrame Forum

Improve how a user changes their password

http://forum.strataframe.net/Topic12500.aspx

By Greg McGuffey - 11/6/2007

Provide a mechanism to change the current users password and/or to change an arbitrary users password using just the user PK.



As far as I know, the only mechanism provided to allow users to change passwords is to use the Login.ShowPasswordChangeForm(), which is pretty cumbersome and not obvious how to use (to me anyway). This form takes a SFSUsersBO and then that BO must be saved if the user actually entered information that would change the password. I.e. currently the following is needed to change a users password:



Using userBO as New SFSUsersBO()

userBO.FillByPrimaryKey(SecurityBasics.CurrentUser.UserPK)

If Login.ShowPasswordChangeForm(userBO) Then

userBO.Save()

End If

End Using




Seems to me there could easily be a method (or two...or overloads) to more easily allow for the changing of a users password:



Public Function ChangeCurrentUsersPassword()

Return ChangeUserPassword(SecurityBasics.CurrentUser.UserPK)

End Function



Public Function ChangeUserPassword(userPK As Integer)

Dim changed As Boolean

Using userBO as New SFSUsersBO()

userBO.FillByPrimaryKey(userPK)

If Login.ShowPasswordChangeForm(userBO) Then

userBO.Save()

changed = True

Else

changed = False

End If

End Using

Return changed

End Function




With some function like this, only a single line of code would be needed and it would be pretty obvious how to implement it! BigGrin
By StrataFrame Team - 11/13/2007

Yes, that would prevent you from needing to create and manage the SFSUsersBO object.  I'll address that when I make the changes to the password change dialog.