The "Forgot Password" form appears beneath my login form which I think users will find confusing - is it possible to present this as a tab or as a collapsed fieldset?

I've attached a screenshot.

Comments

jghyde’s picture

I think that you can hide that div with a JQuery toggle on the "Forgot Password." Click on the "Forgot Password" link and the div appears. Would that solve this?

I am starting to have reservations about the tabs on the user/login page, which I find as confusing.

Joe

locomo’s picture

Yeah - I think that would work. Would it be weird if clicking "Forgot Password" also collapsed the login form at the same time (and vice versa). I have some very basic users and if they see form fields might just start filling everything out :)

thanks Joe.

jghyde’s picture

This fixes the problem of the forgot passwd submit not closing the modal frame:

<?php
// starting at line 87 of modalframe_register.module 6--1-- DEV version
/**
 * Implementation of hook_form_alter().
 */
function modalframe_register_form_alter(&$form, $form_state, $form_id) {
  // Append our submit handler. This is required if we want a chance to
  // close the modal frame dialog.
  $form['#submit'][] = 'modalframe_register_form_submit';
  if ($form_id == 'user_register') {
    $form['#redirect'] = 'modal/register/welcome';
  }
}

/**
 * Submit handler for our node edit form example.
 */
function modalframe_register_form_submit($form, &$form_state) {
  // close the frame for login submit
  if ($form_state['values']['op'] == t('Log in')) {
    modalframe_close_dialog(array(
      'message' => t('Processing the form...'),
    ));
  }
  // Close the frame for forgot passwd submit
  if ($form_state['values']['op'] == t('E-mail new password')) {
    drupal_set_message(t('Your password instructions were emailed to your registered email address.'));
    modalframe_close_dialog(array(
      'message' => t('Password reset directions are getting emailed...'),
    ));
  }
}
?>
locomo’s picture

cool.. i can confirm that this works

however the message:
drupal_set_message(t('Your password instructions were emailed to your registered email address.'));

isn't being displayed for me - i think probably because I have Boost installed and am showing cached pages. Do you know if you can make this module more compatible with Boost? I think adding "nocache=1" will skip the boost cache so the message will be displayed

also.. this technically wasn't the issue that was posed here though its a very useful fix

as a temporary workaround to the original issue i've modified your module to put the "Forgot password" form in a collapsed fieldset

/**
 * Menu callback; login form in child window.
 */
function modalframe_register_page_login_form() {
  // Send the Modal Frame javascript for child windows to the page.
  modalframe_child_js();
  // Get the forms from the user module.
  module_load_include('inc', 'user', 'user.pages');
  // Render the page contents.
  $output = drupal_get_form('user_login');
$output .= '<script type="text/javascript" src="/misc/collapse.js"></script>';
$output .= '<fieldset class="collapsible collapsed">';
$output .= '<legend>' . t('Forgot your password?') . '</legend>';
$output .= '<div class="fieldset-wrapper">' . drupal_get_form('user_pass') . '</div>';
$output .= '</fieldset>';
  return $output;
}

is there a better way to embed the javascript than the way i did it (hardcoded) ?

jghyde’s picture

StatusFileSize
new609 bytes

Here is a patch that includes #3 above. Please review and see if we can commit this to the next rev.

joe

locomo’s picture

Assigned: Unassigned » jghyde
Status: Active » Patch (to be ported)

i think we posted at exactly the same time :)

see my comments above your patch

jghyde’s picture

Title: "Forgot Password" appears in modalfram login » "Forgot Password" appears in modalframe login

#4 is a separate feature request. Moving it to it's own thread. Thanks for the contrib. I'll integrate this into a patch this week hopefully.

Here's the feature request for collapsed forgot password form: http://drupal.org/node/873894

joe

jghyde’s picture

Status: Patch (to be ported) » Needs review
locomo’s picture

Status: Needs review » Patch (to be ported)

great - thanks!

jghyde’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new14.84 KB

I have made extensive modifications to the functionality of this module. It's all for the better.

This patch includes the "No Page Reload" fix in #871976: Page reloads when modal window is closed without logging in/registering.

Also included:

1. More robust messaging in the Status Messages after closing the modal dialog

2. A return page that works, for inside the modal frame after the user submits the User Registration form (you can add the FB Connect thing here, for example)

3. Forgot password is in a collapsed DIV, using default Drupal behaviors

4. A README.txt file with some instructions on how to theme the output of the module.

This patch is made against the HEAD version. Please review and let me know if there are any more bugs related to this issue.

Thanks!

Joe Hyde
http://www.hydeinteractive.com/

stennie’s picture

Joe's changes in #10 make the module usable imho (particularly having some documentation, but also better functionality).

Would be great to see them included in a proper "anniversary" release (it's been just over a year!).

Cheers,
Stephen