Password Reset tabs is a simple UI for changing drupal password.It provides a simple workflow,i.e a series of tabular steps on same page for changing drupal user account password.

Though there are some modules available which bypass the one time login form, which appears after pasting password reset link, ex: simple_pass_reset

How Password Reset tabs is Different:
Password Reset tabs module provides a complete workflow for changing the password on the same page, instead of redirecting the user from reset form to reset link and than to one time login form after which user goes to account form and changes password.
This module provides a very simple UI for forgot password workflow which lot of users need in their website.

Project Page: PasswordResetTabs.

GIT Repository: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/saurabh.tripathi.cs/2403787.git password_reset_tabs

Manual reviews of other projects:

Review cycle one:
https://www.drupal.org/node/2445039#comment-9683881

Review cycle Two:
https://www.drupal.org/node/2446929#comment-9699347
https://www.drupal.org/node/2450675#comment-9711517
https://www.drupal.org/node/2316301#comment-9712245
https://www.drupal.org/node/2450089#comment-9715851

Review cycle three:
https://www.drupal.org/node/2508652#comment-10045050
https://www.drupal.org/node/2501103#comment-10045344
https://www.drupal.org/node/2507433#comment-10045396
https://www.drupal.org/node/2505219#comment-10045430

Comments

saurabh.tripathi.cs’s picture

Issue summary: View changes
saurabh.tripathi.cs’s picture

Issue summary: View changes
saurabh.tripathi.cs’s picture

Issue summary: View changes
kandy-io’s picture

Manual Review

I have just install your module and verify i have some points:

das.gautam’s picture

Hello Saurabh,
The "core" key is used twice in password_reset_tabs.info, please correct.
core = 7.x
core = "7.x"

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

saurabh.tripathi.cs’s picture

Hi,
I have fixed #4 and #5.
Removed extra core defined in info file.
Added hook_help and hook_permission.

Thanks

saurabh.tripathi.cs’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
anup.singh’s picture

Hi Saurab,

module_load_include('inc', 'user', 'user.pages'); is used at both header of file and in function definition of password_reset_tabs_pass_reset_page();

saurabh.tripathi.cs’s picture

StatusFileSize
new58.1 KB

.

saurabh.tripathi.cs’s picture

Hi,
Fixed #9.
Thanks.

saurabh.tripathi.cs’s picture

Issue summary: View changes
joshi.rohit100’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus

Review :-

1. Don't know why you have

      module_load_include('inc', 'user', 'user.pages');
    

in module starting ?

2. Few methods returning string / message without using t(). Example - password_reset_tabs_validation().
3. No documentation for $option array in password_reset_tabs_pass_reset_page().

Also I checked the reviews done by you and most of them looked to me same as pareview bot. So I am removing the PAreview bonus tag. Do review 3 more applications.

Thanks

saurabh.tripathi.cs’s picture

Status: Needs work » Needs review

Hi Rohit,
Thanks for the review.
1) I have included user.pages.inc file as in the menu callback user_pass form is being called.
Added Documentation for the same.

  $items['password_reset'] = array(
    'title' => 'Password Reset',
    'access arguments' => array('password reset tabs'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('user_pass'),
    'weight' => 0,
  );

2) Used t() everywhere returning string / message.
3) Added documentation for $option array in password_reset_tabs_pass_reset_page().
4) I am Reviewing other projects with different perspectives.
Example:https://www.drupal.org/node/2446929#comment-9699347

Note: I am new in review process so a set of guidelines as how to review other projects would be helpful.

kandy-io’s picture

Hi! saurabh.tripathi.cs

in: password_reset_tabs_menu()

EDIT: titles in hook_menu() must not be translated with t(), so this is fine.

saurabh.tripathi.cs’s picture

Thanks again for this review.
Well i researched about this.
For now :

On exploring this link i found that menu title are given inside t(). here:

https://api.drupal.org/api/drupal/includes%21menu.inc/group/menu/7

But Drupal 7 core modules are not following this also i checked some contributed modules, they are also not using this.
Seems to me it is not a standard.Also i got some suggestions from other drupal developers: do not use t() in menu.

saurabh.tripathi.cs’s picture

Issue summary: View changes
shashwat purav’s picture

Status: Needs review » Needs work

Automated Review

	FILE: /var/www/drupal-7-pareview/pareview_temp/password_reset_tabs.module
	---------------------------------------------------------------
	FOUND 2 ERRORS AFFECTING 2 LINES
	---------------------------------------------------------------
	 141 | ERROR | Expected "if (...) {\n"; found "if(...) {\n"
	 150 | ERROR | Expected "if (...) {\n"; found "if(...) {\n"
	---------------------------------------------------------------
	

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows / No: Does not follow the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
[List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:
  1. Please add spacing between functions as per the Drupal standards.
  2. You can allow to change password of the all existing users on the site for users with certain roles (admin roles).

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

nitesh pawar’s picture

Issue summary: View changes
nitesh pawar’s picture

Issue summary: View changes
saurabh.tripathi.cs’s picture

Hi shashwat-purav ,
Thanks for the review.
Fixed issues mentioned in #18.
In Your recommendation : "You can allow to change password of the all existing users on the site for users with certain roles (admin roles)."
By this if you mean than any user can change password than it is already implemented.
Also you can give permission to any role for accessing this link and changing password.

saurabh.tripathi.cs’s picture

Status: Needs work » Needs review
shashwat purav’s picture

@saurabh.tripathi.cs, I'm just mentioning that "admin" role can have privilege to change other user's passwords too.

On the other hand, it's your design. You can pick up my suggestion as a feature request.

saurabh.tripathi.cs’s picture

Issue summary: View changes
saurabh.tripathi.cs’s picture

Issue tags: +PAreview: review bonus
klausi’s picture

Assigned: Unassigned » joachim
Status: Needs review » Needs work
Issue tags: -PAreview: review bonus +PAreview: security

manual review:

  1. password_reset_tabs.module: why do you module_load_include() in the global scope? That means the file is loaded on every single page request, which is not necessary. You should only include it when you actually need it in function bodies.
  2. password_reset_tabs_new_password: no need to call drupal_render() here, just return the $form render array. Drupal core will render it later for you.
  3. This module has a severe security vulnerability. As part of our git admin training I'm assigning this to joachim so that he can take a look. If he does not have time I will post details about the security vulnerability in one week. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

klausi’s picture

Assigned: joachim » Unassigned

OK, posting the details about the vulnerability now:

password_reset_tabs_pass_reset_page() is vulnerable to access bypass problems. Any anonymous attacker can login as arbitrary user by just going to the page /user/reset/1/f/a/i/l and BOOM! They will be logged in as user 1. You need to make sure that users can only login if their password reset link is valid.

saurabh.tripathi.cs’s picture

Status: Needs work » Needs review

Hi klausi ,

Thanks for the review.

I have fixed all the points mention above comments.

1. module_load_include() moved to function instead of global scope.
2. Removed drupal_render()
3. Security vulnerability : Provided a Access callback function to handle password_reset_tabs_pass_reset_page() vulnerability to access bypass problems.

saurabh.tripathi.cs’s picture

Priority: Normal » Major
kandy-io’s picture

Manual Review:
In password_reset_tabs.module
Line: 138:
$timestamp <= $current && $account = reset($users)

We should place out of if statement, and make sure $account not empty before you use it: $account->login
like this:

$account = reset($users)
if($timestamp <= $current && !empty($account)){
//
}

Line 93,175:
Becarefull with arg(2) and make sure it not empty = if(isset(arg(2))...

$uid = arg(2);
$user = user_load($uid);

You are using user_load https://api.drupal.org/api/drupal/modules!user!user.module/function/user_load/7, It may be return FALSE,
$user->uid will cause error.

Please check $user is not empty. 


kandy-io’s picture

Status: Needs review » Needs work
saurabh.tripathi.cs’s picture

Hi kandy-io,

Thanks for the review.
$account is being assigned value from $users:

$users = user_load_multiple(array($uid), array('status' => '1'));
  if ($timestamp <= $current && $account = reset($users)) {

So i don't think there is a need for an empty check there.

Added check for arg() and that serves good for $user also.

saurabh.tripathi.cs’s picture

Status: Needs work » Needs review
suhel.rangnekar’s picture

Status: Needs review » Needs work

In password_reset_tabs.module
Line: 138:
$timestamp <= $current && $account = reset($users)
you should check the !empty for $account before use otherwise it's gives error while accessing the $account object.
So add validation for $account variable.
like kandy-io said,
$account = reset($users)
if($timestamp <= $current && !empty($account)){

saurabh.tripathi.cs’s picture

Thanks suhel.rangnekar,

Added the empty check.

$account = reset($users);
  if ($timestamp <= $current && !empty($account)) {
saurabh.tripathi.cs’s picture

Status: Needs work » Needs review
saurabh.tripathi.cs’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
myvo’s picture

Status: Needs review » Needs work

Hi saurabh.tripathi.cs,

In "password_reset_tabs.info" file has script:

scripts[] = js/password_reset_tabs.js

Please add this file into git repos, or if it's not use, please remove this line.

saurabh.tripathi.cs’s picture

StatusFileSize
new153.2 KB
saurabh.tripathi.cs’s picture

Status: Needs work » Needs review

Hi myvo,
The js file is now in git repo also,
Thanks

klausi’s picture

Issue tags: -PAreview: review bonus

Removing review bonus tag, you have not added 3 more reviews to the issue summary? Please only add it back when there are at least 6 manual review comments in the issue summary.

saurabh.tripathi.cs’s picture

@klausi,
I did add 4 new reviews to the issue summary.These are new reviews.May be you want me to list all the reviews in the summary?
Please clarify.

Thanks

saurabh.tripathi.cs’s picture

Issue summary: View changes
klausi’s picture

Issue tags: +PAreview: review bonus

yes, please list all your manual reviews in the issue summary. Thanks!

klausi’s picture

Issue summary: View changes

Removed automated reviews with no manual source code review.

klausi’s picture

Status: Needs review » Needs work

Review of the 7.x-1.x branch (commit 297c110):

js/password_reset_tabs.js: line 6, col 1, Error - Missing "use strict" statement. (strict)
js/password_reset_tabs.js: line 10, col 68, Error - Missing space before function parentheses. (space-before-function-paren)
js/password_reset_tabs.js: line 10, col 70, Error - Missing space before opening brace. (space-before-blocks)
js/password_reset_tabs.js: line 10, col 83, Error - Missing whitespace after semicolon. (semi-spacing)

4 problems
  • Codespell has found some spelling errors in your code.
    ./README.txt:32: acces  ==> access
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
  • This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

    manual review:

    1. "user_pass_rehash($account->pass, $timestamp, $account->login)": this function call misses the 4th parameter, which is important for security reasons. This was fixed in one of the more recent core releases. It is important that you get the security APIs right for critical functionality like this. Make sure to test your module with the latest version of Drupal core, you should get PHP warnings when you miss the 4th parameter on that function.
    2. password_reset_tabs_pass_reset_page(): why do you use arg() here for the $uid when it gets passed in as parameter to the function? Should not be necessary?
    3. password_reset_tabs_done(): why do you destroy the session here? Please add a comment.
    4. If I go to /password_reset/new_password as anonymous user I see a user registration form and can create new user accounts. That works even if I have set my Drupal site set to "only admins can create accounts", so this is a security issue. I think you should deny access or redirect anonymous users on that page.

    Please make sure that you test your module properly against all scenarios, since this very security sensitive functionality.

    saurabh.tripathi.cs’s picture

    Status: Needs work » Needs review
    Issue tags: -PAreview: review bonus

    @klausi,
    Thanks for this review.

    Status for the issues mentioned in #46

    ES LINT issues: Fixed and tested
    Manual review:
    1)Added fourth parameter $uid.
    2)Removed arg() as it was not needed.
    3)Added comment for destroying session.
    4)Provided access denied for new password tab.

    I have tested this module for all above scenarios.

    saurabh.tripathi.cs’s picture

    New Improvements:

    1) Converted drupal_goto to form redirect.
    2) Optimized nested if else statements using ternary operator.
    3) Handled menu security by token generation.
    4) Removing hook permission as menu security handled by tokens and also this functionality should work for anonymous.
    5) Retested this for all security loopholes.

    Note: Security for menu alter remains by providing separate access callback.

    tusharbodke’s picture

    Status: Needs review » Reviewed & tested by the community

    Hi Saurabh,
    I installed, tested and ran through your code. Everything looks great! This can be used as a new UI for changing Drupal password.

    Reports

    Online Automated testing report
    http://pareview.sh/pareview/httpgitdrupalorgsandboxsaurabhtripathics2403787git

    Code is clean.

    Manual review result:
    Individual user account
    Yes
    No duplication
    Yes
    Master Branch
    Yes
    Licensing
    Yes
    3rd party assets/code
    Yes
    README.txt/README.md
    Yes
    Code long/complex enough for review
    Yes : Code is long enough for review.
    Secure code
    Yes : Looks secured
    Coding style & Drupal API usage
    Yes : Looks good and follows drupal coding standards.

    Thanks for your contribution, Saurabh.

    joshi.rohit100’s picture

    scripts[] = js/password_reset_tabs.js

    This will load your js file on every page whether it is required or not.
    It should be loaded on required pages only.

    cweagans’s picture

    Status: Reviewed & tested by the community » Fixed

    Thanks for your contribution!

    I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

    Here are some recommended readings to help with excellent maintainership:

    You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

    Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

    Thanks to the dedicated reviewer(s) as well.

    Status: Fixed » Closed (fixed)

    Automatically closed - issue fixed for 2 weeks with no activity.