Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
83e8d88d
Commit
83e8d88d
authored
Aug 13, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) refactor src/www/system_usermanager_passwordmg.php
parent
9f66d8f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
66 deletions
+54
-66
system_usermanager_passwordmg.php
src/www/system_usermanager_passwordmg.php
+54
-66
No files found.
src/www/system_usermanager_passwordmg.php
View file @
83e8d88d
...
...
@@ -29,7 +29,7 @@
require_once
(
"guiconfig.inc"
);
$pgtitle
=
array
(
gettext
(
"System"
),
gettext
(
"User Password"
));
$pgtitle
=
array
(
gettext
(
"System"
),
gettext
(
"User Password"
));
if
(
session_status
()
==
PHP_SESSION_NONE
)
{
session_start
();
...
...
@@ -37,7 +37,7 @@ if (session_status() == PHP_SESSION_NONE) {
$username
=
$_SESSION
[
'Username'
];
if
(
isset
(
$_POST
[
'save'
]))
{
unset
(
$input_errors
);
$input_errors
=
array
(
);
/* input validation */
$reqdfields
=
explode
(
" "
,
"passwordfld0 passwordfld1 passwordfld2"
);
...
...
@@ -49,7 +49,19 @@ if (isset($_POST['save'])) {
$input_errors
[]
=
gettext
(
"The passwords do not match."
);
}
if
(
!
$input_errors
)
{
/* determine if user is not local to system */
$userFound
=
false
;
foreach
(
$config
[
'system'
][
'user'
]
as
$user
)
{
if
(
$user
[
'name'
]
==
$username
)
{
$userFound
=
true
;
}
}
if
(
!
$userFound
)
{
$input_errors
[]
=
gettext
(
"Sorry, you cannot change the password for a non-local user."
);
}
if
(
count
(
$input_errors
)
==
0
)
{
// all values are okay --> saving changes
$config
[
'system'
][
'user'
][
$userindex
[
$username
]][
'password'
]
=
crypt
(
$_POST
[
'passwordfld1'
],
'$6$'
);
local_user_set
(
$config
[
'system'
][
'user'
][
$userindex
[
$username
]]);
...
...
@@ -62,84 +74,60 @@ if (isset($_POST['save'])) {
session_write_close
();
/* determine if user is not local to system */
$islocal
=
false
;
foreach
(
$config
[
'system'
][
'user'
]
as
$user
)
{
if
(
$user
[
'name'
]
==
$username
)
{
$islocal
=
true
;
}
}
include
(
"head.inc"
);
?>
<body>
<?php
include
(
"fbegin.inc"
);
?>
<section
class=
"page-content-main"
>
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<?
<?
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
{
print_input_errors
(
$input_errors
);
}
if
(
isset
(
$savemsg
))
{
print_info_box
(
$savemsg
);
}
if
(
$islocal
==
false
)
{
echo
gettext
(
"Sorry, you cannot change the password for a non-local user."
);
include
(
"foot.inc"
);
exit
;
}
?>
<section
class=
"col-xs-12"
>
<div
class=
"content-box"
>
<form
action=
"system_usermanager_passwordmg.php"
method=
"post"
name=
"iform"
id=
"iform"
>
<div
class=
"table-responsive"
>
<table
class=
"table table-striped table-sort"
>
<tr>
<td
colspan=
"2"
valign=
"top"
class=
"listtopic"
>
<?=
$username
?>
's
<?=
gettext
(
"Password"
);
?>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Old password"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<input
name=
"passwordfld0"
type=
"password"
class=
"formfld pwd"
id=
"passwordfld0"
size=
"20"
/>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"New password"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<input
name=
"passwordfld1"
type=
"password"
class=
"formfld pwd"
id=
"passwordfld1"
size=
"20"
/>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Confirmation"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<input
name=
"passwordfld2"
type=
"password"
class=
"formfld pwd"
id=
"passwordfld2"
size=
"20"
/>
</td>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
>
</td>
<td
width=
"78%"
>
<input
name=
"save"
type=
"submit"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
</td>
</tr>
</table>
?>
<section
class=
"col-xs-12"
>
<div
class=
"content-box"
>
<form
action=
"system_usermanager_passwordmg.php"
method=
"post"
name=
"iform"
id=
"iform"
>
<div
class=
"table-responsive"
>
<table
class=
"table table-striped"
>
<tr>
<td
colspan=
"2"
>
<?=
$username
?>
's
<?=
gettext
(
"Password"
);
?>
</td>
</tr>
<tr>
<td>
<?=
gettext
(
"Old password"
);
?>
</td>
<td>
<input
name=
"passwordfld0"
type=
"password"
id=
"passwordfld0"
size=
"20"
/>
</td>
</tr>
<tr>
<td>
<?=
gettext
(
"New password"
);
?>
</td>
<td>
<input
name=
"passwordfld1"
type=
"password"
id=
"passwordfld1"
size=
"20"
/>
</td>
</tr>
<tr>
<td>
<?=
gettext
(
"Confirmation"
);
?>
</td>
<td>
<input
name=
"passwordfld2"
type=
"password"
id=
"passwordfld2"
size=
"20"
/>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input
name=
"save"
type=
"submit"
class=
"btn btn-primary"
value=
"
<?=
gettext
(
"Save"
);
?>
"
/>
</td>
</tr>
</table>
</div>
</form>
</form>
</div>
</section>
</div>
</section>
</div>
</section>
</div>
</section>
<?php
include
(
"foot.inc"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment