How can site users change their passwords?

40 views
Skip to first unread message

Wouter

unread,
Apr 13, 2011, 2:49:00 PM4/13/11
to Vosao CMS Development
Site users cannot access /cms/profile.vm, where other users change
their passwords. Is there an alternative for them to change their own
passwords?

Thanks,
Wouter

Alexander Oleynik

unread,
Apr 13, 2011, 5:31:54 PM4/13/11
to vosao-cms-...@googlegroups.com
I am afraid that currently there is no way to do that.
But we can implement JSON-RPC call for this in register plugin.

Will such method work for you?

// service call from javascript

Vosao.jsonrpc.registerFrontService.changePassword(function(r) {
// Show success message
}, userId, oldPassword, newPassword);

Wouter

unread,
Jun 17, 2011, 7:59:19 AM6/17/11
to vosao-cms-...@googlegroups.com
Hi Alex,

An RPC call will certainly solve the issue as it makes it possible to create a change-password page. So, yes, it would be great if something like that is possible.

Thanks for the quick reply, and sorry for my late reply; this message unfortunately missed my inbox.

Wouter

Alexander Oleynik

unread,
Jul 10, 2011, 5:21:00 AM7/10/11
to vosao-cms-...@googlegroups.com
Implemented by commit 1070.

Published in register-0.9.1.war

Wouter

unread,
Jul 22, 2011, 5:26:52 AM7/22/11
to vosao-cms-...@googlegroups.com
Hi Alex,

Thanks for adding changePassword to the register plugin. I'm now trying to create a form to use it. Below is what I have so far. At first glance it seems to work, but the service always returns 'success', even if the old password is incorrect, and it never has any effect, even if the old password is correct.

Am I doing something wrong?

Wouter

<script type="text/javascript"><!--

function submitPasswordForm(currentPass, newPass1, newPass2) {
  if (newPass1 == "")
    $('#password-messages').html('<span class="error-message">New password field is empty.</span>');
  else if (newPass1 != newPass2)
    $('#password-messages').html('<span class="error-message">Please enter the same password twice!</span>');
  else
    changePassword(currentPass, newPass1);

  return false;
}

function changePassword(currentPass, newPass) {
  Vosao.jsonrpc.registerFrontService.changePassword(function(r,e) {
    if (Vosao.serviceFailed(e))
    {
      $('#password-messages').html('<span class="error-message">Password change failed.</span>');
      document.location.href = '$page.friendlyURL';
    }
    else if (r.result == 'success')
    {
      $('#password-messages').html('<span class="success-message">Success.</span>');
      document.location.href = '$page.friendlyURL';
    } else {
      $('#password-messages').html('<span class="error-message">' + r.message + '</span>');
    }
  }, $user.id, currentPass, newPass);
}

//-->
</script>

<form method="get" action="$page.friendlyURL" onsubmit="return submitPasswordForm(currentPass.value, newPass1.value, newPass2.value);">
<div><label>Current password:</label> <input name="currentPass" type="password" value=""/></div>
<div><label>New password:</label> <input name="newPass1" type="password" value=""/></div>
<div><label>Retype password:</label> <input name="newPass2" type="password" value=""/></div>
<div id="password-messages"></div>
<div><input name="ChangePassword" type="submit" value="Change Password"/></div>
</form>
Reply all
Reply to author
Forward
0 new messages