Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
archery
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Taddeüs Kroes
archery
Commits
10e32f5c
Commit
10e32f5c
authored
10 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix + made account editing actions responsive
parent
105ca2d9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
routes/user.php
+5
-9
5 additions, 9 deletions
routes/user.php
templates/user/edit.latte
+18
-1
18 additions, 1 deletion
templates/user/edit.latte
util.php
+10
-0
10 additions, 0 deletions
util.php
with
33 additions
and
10 deletions
routes/user.php
+
5
−
9
View file @
10e32f5c
...
...
@@ -5,14 +5,9 @@ use Instante\Bootstrap3Renderer\BootstrapRenderer;
use
Nette\Security\Passwords
;
function
find_user
(
$id
)
{
global
$app
,
$db
,
$user
;
if
(
!
$user
->
isLoggedIn
())
$app
->
redirect
(
ROOT_URL
.
'/login'
);
if
(
$user
->
getId
()
!=
$id
&&
!
in_array
(
'admin'
,
$user
->
getRoles
()))
$app
->
halt
(
403
,
_
(
'No access to this user'
));
global
$app
,
$db
;
require_user_access
(
$id
);
$dbuser
=
$db
->
table
(
'user'
)
->
get
(
$id
);
if
(
!
$dbuser
)
...
...
@@ -51,8 +46,9 @@ $app->get('/user/:id', function ($id) use ($app, $db) {
});
$app
->
get
(
'/user/:id/edit'
,
function
(
$id
)
use
(
$app
)
{
$form
=
edit_user_form
(
find_user
(
$id
));
$app
->
render
(
'user/edit'
,
compact
(
'form'
));
$dbuser
=
find_user
(
$id
);
$form
=
edit_user_form
(
$dbuser
);
$app
->
render
(
'user/edit'
,
compact
(
'dbuser'
,
'form'
));
});
$app
->
put
(
'/user/:id'
,
function
(
$id
)
use
(
$app
)
{
$dbuser
=
find_user
(
$id
);
...
...
This diff is collapsed.
Click to expand it.
templates/user/edit.latte
+
18
−
1
View file @
10e32f5c
...
...
@@ -2,5 +2,22 @@
{block content}
<h2 class="page-header">{_'Edit account'}</h2>
{$form}
{form $form}
{form errors}
{form controls}
<div class="form-group">
<div class="form-actions col-sm-offset-2 col-sm-10">
<div class="btn-group actions actions-responsive">
<a href="user/{$dbuser->id}" class="btn btn-default" title="{_'Cancel'}">
<span class="glyphicon glyphicon-remove"></span>
<span class="text">{_'Cancel'}</span>
</a>
<button type="submit" name="send" class="btn btn-primary" title="{_'Save'}">
<span class="glyphicon glyphicon-ok"></span>
<span class="text">{_'Save'}</span>
</button>
</div>
</div>
</div>
{/form}
{/block}
This diff is collapsed.
Click to expand it.
util.php
+
10
−
0
View file @
10e32f5c
...
...
@@ -45,6 +45,16 @@ function set_accept_locale($supported_languages=null) {
return
null
;
}
function
require_user_access
(
$user_id
)
{
global
$user
,
$app
;
if
(
!
$user
->
isLoggedIn
())
$app
->
redirect
(
ROOT_URL
.
'/login'
);
if
(
$user
->
getId
()
!=
$user_id
&&
!
in_array
(
'admin'
,
$user
->
getRoles
()))
$app
->
halt
(
403
,
_
(
'No access to this user'
));
}
function
find_match
(
$id
)
{
global
$app
,
$db
,
$user
;
$match
=
$db
->
table
(
'match'
)
->
get
(
$id
);
...
...
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