Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
archery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
archery
Commits
6544335c
Commit
6544335c
authored
Oct 14, 2014
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed field names on password change page to improve form auto-completion
parent
3bca7331
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
routes/user.php
routes/user.php
+9
-9
No files found.
routes/user.php
View file @
6544335c
...
@@ -29,13 +29,13 @@ function edit_user_form($dbuser) {
...
@@ -29,13 +29,13 @@ function edit_user_form($dbuser) {
$form
->
addPassword
(
'current_password'
,
_
(
'Current password'
))
$form
->
addPassword
(
'current_password'
,
_
(
'Current password'
))
->
setRequired
()
->
setRequired
()
->
addRule
(
$check_current_password
,
_
(
'Password incorrect'
));
->
addRule
(
$check_current_password
,
_
(
'Password incorrect'
));
$form
->
addPassword
(
'password'
,
_
(
'New password'
))
$form
->
addPassword
(
'
new_
password'
,
_
(
'New password'
))
->
addCondition
(
Form
::
FILLED
)
->
addCondition
(
Form
::
FILLED
)
->
addRule
(
Form
::
MIN_LENGTH
,
sprintf
(
_
(
'Password must be at least %d charachers'
),
->
addRule
(
Form
::
MIN_LENGTH
,
sprintf
(
_
(
'Password must be at least %d charachers'
),
MIN_PASSWORD_CHARS
),
MIN_PASSWORD_CHARS
);
MIN_PASSWORD_CHARS
),
MIN_PASSWORD_CHARS
);
$form
->
addPassword
(
'password_repeat'
,
_
(
'Confirm new password'
))
$form
->
addPassword
(
'
new_
password_repeat'
,
_
(
'Confirm new password'
))
->
addConditionOn
(
$form
[
'password'
],
Form
::
FILLED
)
->
addConditionOn
(
$form
[
'
new_
password'
],
Form
::
FILLED
)
->
addRule
(
Form
::
EQUAL
,
_
(
'Passwords must match'
),
$form
[
'password'
]);
->
addRule
(
Form
::
EQUAL
,
_
(
'Passwords must match'
),
$form
[
'
new_
password'
]);
$form
->
addSubmit
(
'send'
,
_
(
'Save'
))
->
setAttribute
(
'class'
,
'btn-primary'
);
$form
->
addSubmit
(
'send'
,
_
(
'Save'
))
->
setAttribute
(
'class'
,
'btn-primary'
);
return
$form
;
return
$form
;
...
@@ -50,7 +50,7 @@ $app->get('/user/:id/edit', function ($id) use ($app) {
...
@@ -50,7 +50,7 @@ $app->get('/user/:id/edit', function ($id) use ($app) {
$form
=
edit_user_form
(
$dbuser
);
$form
=
edit_user_form
(
$dbuser
);
$app
->
render
(
'user/edit'
,
compact
(
'dbuser'
,
'form'
));
$app
->
render
(
'user/edit'
,
compact
(
'dbuser'
,
'form'
));
});
});
$app
->
put
(
'/user/:id'
,
function
(
$id
)
use
(
$app
)
{
$app
->
put
(
'/user/:id'
,
function
(
$id
)
use
(
$app
,
$user
)
{
$dbuser
=
find_user
(
$id
);
$dbuser
=
find_user
(
$id
);
$form
=
edit_user_form
(
$dbuser
);
$form
=
edit_user_form
(
$dbuser
);
$form
->
validate
();
$form
->
validate
();
...
@@ -58,18 +58,18 @@ $app->put('/user/:id', function ($id) use ($app) {
...
@@ -58,18 +58,18 @@ $app->put('/user/:id', function ($id) use ($app) {
if
(
!
$form
->
hasErrors
())
{
if
(
!
$form
->
hasErrors
())
{
$values
=
$form
->
getValues
();
$values
=
$form
->
getValues
();
if
(
$values
->
password
)
{
if
(
$values
->
new_
password
)
{
$dbuser
->
update
(
array
(
$dbuser
->
update
(
array
(
'password'
=>
Passwords
::
hash
(
$values
->
password
)
'password'
=>
Passwords
::
hash
(
$values
->
new_
password
)
));
));
//$user->logout();
//$user->logout();
//$user->login($dbuser->username, $values->password);
//$user->login($dbuser->username, $values->
new_
password);
}
}
$app
->
redirect
(
ROOT_URL
.
"/user/
$id
"
);
$app
->
redirect
(
ROOT_URL
.
"/user/
$id
"
);
}
}
$app
->
render
(
'user/edit'
,
compact
(
'form'
));
$app
->
render
(
'user/edit'
,
compact
(
'
dbuser'
,
'
form'
));
});
});
$app
->
put
(
'/user/:id'
,
function
(
$id
)
{
$app
->
put
(
'/user/:id'
,
function
(
$id
)
{
...
...
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