Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CD-CODE Web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
CD-CODE team
CD-CODE Web
Commits
d84f0b27
Commit
d84f0b27
authored
3 years ago
by
moon
Browse files
Options
Downloads
Patches
Plain Diff
Added the security check according to the role
parent
29373e4f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
web/src/views/Profile.vue
+7
-2
7 additions, 2 deletions
web/src/views/Profile.vue
web/src/views/UpdateItem.vue
+21
-13
21 additions, 13 deletions
web/src/views/UpdateItem.vue
with
28 additions
and
15 deletions
web/src/views/Profile.vue
+
7
−
2
View file @
d84f0b27
...
...
@@ -6,7 +6,6 @@
<div
v-if=
"loading || response === null"
></div>
<div
v-else
>
<!--
{{
response
}}
-->
<h4
class=
"round"
>
User Profile
</h4>
<div
class=
"panel panel-default"
>
<div
class=
"panel-body"
>
...
...
@@ -26,7 +25,7 @@
<div
class=
"row"
>
<div
class=
"text col-sm-3"
>
Role
</div>
<div
class=
"col-sm-9"
>
{{
$store
.
dispatch
(
'
User/setUser
Role
'
,
response
.
role
.
name
)
&&
response
.
role
.
name
}}
{{
set
Role
(
response
.
role
.
name
)
}}
</div>
</div>
<div
class=
"row"
>
...
...
@@ -108,6 +107,12 @@ export default {
},
},
methods
:
{
setRole
(
roleName
)
{
const
vm
=
this
window
.
localStorage
.
setItem
(
'
roleName
'
,
roleName
)
vm
.
$store
.
dispatch
(
'
User/setUserRole
'
,
roleName
)
return
roleName
},
},
mounted
:
function
()
{
const
vm
=
this
...
...
This diff is collapsed.
Click to expand it.
web/src/views/UpdateItem.vue
+
21
−
13
View file @
d84f0b27
<
template
>
<div>
<div
class=
"flex items-center justify-center"
>
<div
class=
"md:flex card p-2 mt-5"
>
<h3
v-show=
"error"
class=
"text-2xl text-red-500"
>
{{
errorMsg
}}
</h3>
<div
v-if=
"loaded"
class=
"md:flex card p-2 mt-5"
>
<div
class=
"p-5 mx-auto text-left font-raleway container max-w-screen-md"
>
<h1
class=
"font-bold text-left font-montserrat text-3xl sm:text-5xl mb-7"
>
{{
item
===
'
new
'
?
'
Create new Update Item
'
:
item
}}
</h1>
<p
v-show=
"error"
class=
"text-lg text-red-500"
>
{{
errorMsg
}}
</p>
<form
@
submit=
"update"
class=
"w-full md:w-auto"
>
<div
class=
"md:flex md:items-center mx-3 mb-6"
>
<div
class=
"md:w-1/3"
>
...
...
@@ -154,6 +154,7 @@ export default {
syncedAt
:
''
,
// datetime
syncResponse
:
''
,
// response from the sync process (errors if any)
comment
:
''
,
// user comment
loaded
:
false
,
error
:
false
,
errorMsg
:
`An error occurred, please try again`
}
...
...
@@ -176,8 +177,7 @@ export default {
const
jwt
=
vm
.
jwt
;
if
(
jwt
===
null
)
{
vm
.
loading
=
false
;
vm
.
response
=
null
;
vm
.
loaded
=
false
;
return
}
...
...
@@ -218,10 +218,10 @@ export default {
// console.log(res)
this
.
$router
.
push
(
'
/profile
'
)
vm
.
$router
.
push
(
'
/profile
'
)
}
catch
(
error
)
{
// console.log(error.response.data.error.message)
console
.
log
(
error
.
response
)
//
console.log(error.response)
this
.
error
=
true
this
.
errorMsg
=
error
}
...
...
@@ -231,8 +231,7 @@ export default {
const
jwt
=
vm
.
jwt
;
if
(
jwt
===
null
)
{
vm
.
loading
=
false
;
vm
.
response
=
null
;
vm
.
loaded
=
false
;
return
}
...
...
@@ -263,17 +262,26 @@ export default {
// SyncedAt:
// SyncResponse:
}
vm
.
loaded
=
true
;
}
catch
(
error
)
{
console
.
log
(
error
)
//
console.
error
(error)
this
.
error
=
true
this
.
errorMsg
=
error
this
.
errorMsg
=
"
You are not authorized to access this item.
"
setTimeout
(()
=>
vm
.
$router
.
go
(
-
1
),
2000
);
}
}
},
mounted
:
function
()
{
const
vm
=
this
if
(
vm
.
item
!==
'
new
'
)
{
vm
.
load
(
vm
.
item
)
const
vm
=
this
;
const
jwt
=
vm
.
jwt
;
if
(
jwt
===
null
)
{
vm
.
$router
.
push
(
'
/login
'
)
}
else
{
if
(
vm
.
item
!==
'
new
'
)
{
vm
.
load
(
vm
.
item
)
}
}
}
}
...
...
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