Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Noreqnewpass
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
Noreqnewpass
Commits
cfd1dbe6
Commit
cfd1dbe6
authored
4 years ago
by
harish137
Committed by
Neslee
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue #2804771 by harish b: noreqnewpass|coder review|Drupal code standards missing
parent
c3181355
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
noreqnewpass.module
+16
-18
16 additions, 18 deletions
noreqnewpass.module
tests/noreqnewpass.test
+3
-1
3 additions, 1 deletion
tests/noreqnewpass.test
with
19 additions
and
19 deletions
noreqnewpass.module
+
16
−
18
View file @
cfd1dbe6
...
...
@@ -3,18 +3,18 @@
/**
* Implementation of hook_menu().
*/
function
noreqnewpass_menu
()
{
function
noreqnewpass_menu
()
{
$items
=
array
();
$items
[
'admin/people/noreqnewpass'
]
=
array
(
'title'
=>
t
(
'No Request New Password'
)
,
'description'
=>
t
(
'Manage password preferences'
)
,
'title'
=>
'No Request New Password'
,
'description'
=>
'Manage password preferences'
,
'access arguments'
=>
array
(
'administer noreqnewpass'
),
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'noreqnewpass_admin_form'
),
'page arguments'
=>
array
(
'noreqnewpass_admin_form'
),
'type'
=>
MENU_LOCAL_TASK
,
);
return
$items
;
}
...
...
@@ -48,29 +48,28 @@ function noreqnewpass_permission() {
);
}
/**
* Implementation of hook_form_alter().
*/
function
noreqnewpass_form_alter
(
&
$form
,
$form_state
,
$form_id
)
{
if
(
$form_id
==
'user_login_block'
&&
variable_get
(
'noreqnewpass_disabled'
,
true
))
{
if
(
$form_id
==
'user_login_block'
&&
variable_get
(
'noreqnewpass_disabled'
,
TRUE
))
{
$items
=
array
();
if
(
variable_get
(
'user_register'
,
USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL
))
{
$items
[]
=
l
(
t
(
'Create new account'
),
'user/register'
,
array
(
'attributes'
=>
array
(
'title'
=>
t
(
'Create a new user account.'
))));
}
$form
[
'links'
]
=
array
(
'#markup'
=>
theme
(
'item_list'
,
array
(
'items'
=>
$items
)));
}
if
((
$form_id
==
'user_login_block'
||
$form_id
==
'user_login'
)
&&
variable_get
(
'noreqnewpass_disabled'
,
true
))
{
if
((
$form_id
==
'user_login_block'
||
$form_id
==
'user_login'
)
&&
variable_get
(
'noreqnewpass_disabled'
,
TRUE
))
{
$key
=
array_search
(
'user_login_final_validate'
,
$form
[
'#validate'
]);
$form
[
'#validate'
][
$key
]
=
'noreqnewpass_user_login_final_validate'
;
}
// Remove pass field from user edit form if he cant change
if
(
$form_id
==
'user_profile_form'
&&
!
user_access
(
"can change your own password"
))
{
$form
[
'account'
][
'current_pass'
][
'#access'
]
=
false
;
$form
[
'account'
][
'pass'
][
'#access'
]
=
false
;
$form
[
'account'
][
'current_pass'
][
'#access'
]
=
FALSE
;
$form
[
'account'
][
'pass'
][
'#access'
]
=
FALSE
;
}
}
...
...
@@ -81,18 +80,17 @@ function noreqnewpass_form_alter(&$form, $form_state, $form_id) {
*/
function
noreqnewpass_admin_form
()
{
$form
=
array
();
$form
[
'noreqnewpass_disabled'
]
=
array
(
'#title'
=>
t
(
'Disable Request new password link'
),
'#type'
=>
'checkbox'
,
'#default_value'
=>
variable_get
(
'noreqnewpass_disabled'
,
true
),
'#default_value'
=>
variable_get
(
'noreqnewpass_disabled'
,
TRUE
),
'#description'
=>
t
(
'If checked, Request new password link will be disabled.'
)
);
return
system_settings_form
(
$form
);
}
/**
* Just for remove request password url at error messages.
*/
...
...
This diff is collapsed.
Click to expand it.
tests/noreqnewpass.test
+
3
−
1
View file @
cfd1dbe6
<?php
/*
* @file
*/
class
NoreqnewpassMenuTestCase
extends
DrupalWebTestCase
{
public
static
function
getInfo
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment