Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SIGPUBLIC
unantes-orientation-active
Commits
1dd41086
Commit
1dd41086
authored
Sep 28, 2021
by
Django Janny
Browse files
UNOTOPLYS-301 - Gestion du cas d'un utilisateur n'ayant aucun droit
parent
379c31ab
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/main/webapp/app/core/error/error.vue
View file @
1dd41086
...
...
@@ -5,7 +5,9 @@
<div
class=
"alert alert-danger"
>
{{
errorMessage
}}
</div>
</div>
<div
v-if=
"error403"
class=
"alert alert-danger"
>
{{
$t
(
'
error.http.403
'
)
}}
</div>
<div
v-if=
"error403"
class=
"alert"
><a
href=
"/login"
>
Page d'accueil
</a></div>
<div
v-if=
"error403"
class=
"alert"
>
<a
href=
"/logout"
>
{{
$t
(
'
error.home
'
)
}}
</a>
</div>
<div
v-if=
"error404"
class=
"alert alert-warning"
>
{{
$t
(
'
error.http.404
'
)
}}
</div>
</div>
</
template
>
...
...
src/main/webapp/app/router/account.ts
View file @
1dd41086
import
{
ROUTES
}
from
'
@/router/routes-constants
'
;
const
Login
=
()
=>
import
(
'
@/views/account/login/login.vue
'
);
const
Logout
=
()
=>
import
(
'
@/views/account/logout/logout.vue
'
);
const
ResetPasswordInit
=
()
=>
import
(
'
@/views/account/reset-password/init/reset-password-init.vue
'
);
const
ResetPasswordFinish
=
()
=>
import
(
'
@/views/account/reset-password/finish/reset-password-finish.vue
'
);
...
...
@@ -10,6 +11,11 @@ export default [
name
:
ROUTES
.
login
.
name
,
component
:
Login
,
},
{
path
:
ROUTES
.
logout
.
path
,
name
:
ROUTES
.
logout
.
name
,
component
:
Logout
,
},
{
path
:
'
/account/reset/request
'
,
name
:
'
ResetPasswordInit
'
,
...
...
src/main/webapp/app/router/routes-constants.ts
View file @
1dd41086
...
...
@@ -7,6 +7,10 @@ export const ROUTES = {
path
:
'
/login
'
,
name
:
'
Login
'
,
},
logout
:
{
path
:
'
/logout
'
,
name
:
'
Logout
'
,
},
notFound
:
{
path
:
'
/not-found
'
,
name
:
'
NotFound
'
,
...
...
src/main/webapp/app/services/account.service.ts
View file @
1dd41086
...
...
@@ -53,9 +53,21 @@ export default class AccountService {
}
if
(
!
this
.
token
||
!
this
.
authenticated
||
!
this
.
userAuthorities
)
{
return
this
.
checkAuth
();
return
this
.
checkAuth
().
then
(
connected
=>
{
if
(
connected
)
{
return
this
.
checkAuthority
(
authorities
);
}
else
{
return
new
Promise
(
resolve
=>
{
resolve
(
false
);
});
}
});
}
else
{
return
this
.
checkAuthority
(
authorities
);
}
}
private
checkAuthority
(
authorities
:
any
):
Promise
<
boolean
>
{
for
(
let
i
=
0
;
i
<
authorities
.
length
;
i
++
)
{
if
(
this
.
userAuthorities
.
includes
(
authorities
[
i
]))
{
return
new
Promise
(
resolve
=>
{
...
...
@@ -63,7 +75,6 @@ export default class AccountService {
});
}
}
return
new
Promise
(
resolve
=>
{
resolve
(
false
);
});
...
...
@@ -93,14 +104,17 @@ export default class AccountService {
if
(
this
.
router
.
getRoutes
().
find
(
r
=>
r
.
path
===
path
)
&&
!
this
.
router
.
getRoutes
().
find
(
r
=>
r
.
path
===
path
).
meta
.
authorities
)
{
return
true
;
}
for
(
let
authority
of
this
.
userAuthorities
)
{
if
(
this
.
router
.
getRoutes
()
.
find
(
r
=>
r
.
path
===
path
)
?.
meta
?.
authorities
?.
includes
(
authority
)
)
{
return
true
;
if
(
this
.
store
.
getters
.
account
)
{
for
(
let
authority
of
this
.
userAuthorities
)
{
if
(
this
.
router
.
getRoutes
()
.
find
(
r
=>
r
.
path
===
path
)
?.
meta
?.
authorities
?.
includes
(
authority
)
)
{
return
true
;
}
}
}
return
false
;
...
...
src/main/webapp/app/views/account/login/login.component.ts
View file @
1dd41086
import
{
mixins
}
from
'
vue-class-component
'
;
import
{
Component
}
from
'
vue-property-decorator
'
;
import
A
dmin
Mixin
from
'
@/views/account/account.mixin
'
;
import
A
ccount
Mixin
from
'
@/views/account/account.mixin
'
;
@
Component
export
default
class
Login
extends
mixins
(
A
dmin
Mixin
)
{
export
default
class
Login
extends
mixins
(
A
ccount
Mixin
)
{
public
authenticationError
=
null
;
public
login
=
null
;
...
...
src/main/webapp/app/views/account/logout/logout.component.ts
0 → 100644
View file @
1dd41086
import
{
mixins
}
from
'
vue-class-component
'
;
import
{
Component
}
from
'
vue-property-decorator
'
;
import
AccountMixin
from
'
@/views/account/account.mixin
'
;
@
Component
export
default
class
Logout
extends
mixins
(
AccountMixin
)
{
beforeRouteEnter
(
to
,
from
,
next
)
{
next
(
vm
=>
{
vm
.
doLogout
();
});
}
public
doLogout
():
void
{
this
.
getAccountService
().
logout
();
}
}
src/main/webapp/app/views/account/logout/logout.vue
0 → 100644
View file @
1dd41086
<
template
>
<section
class=
"max-w-xl mx-auto px-6 py-9 bg-white border border-gray-200"
>
<div
class=
"block flex justify-center mb-8"
>
<img
src=
"/content/images/icons/icon-aplly.svg"
class=
"icon-aplly"
/>
</div>
<div
class=
"m-8 text-center"
>
<router-link
class=
"px-6 py-4 m-1 text-base font-bold text-white bg-blue-600 rounded-full hover:bg-blue-800 focus:bg-blue-900 focus:ring"
:to=
"
{ name: 'Login' }"
>
{{
$t
(
'
global.menu.account.login
'
)
}}
</router-link
>
</div>
</section>
</
template
>
<
script
lang=
"ts"
src=
"./logout.component.ts"
/>
src/main/webapp/app/views/account/reset-password/init/reset-password-init.component.ts
View file @
1dd41086
...
...
@@ -2,7 +2,7 @@ import { mixins } from 'vue-class-component';
import
{
Component
}
from
'
vue-property-decorator
'
;
import
{
email
,
maxLength
,
minLength
,
required
}
from
'
vuelidate/lib/validators
'
;
import
A
dmin
Mixin
from
'
@/views/account/account.mixin
'
;
import
A
ccount
Mixin
from
'
@/views/account/account.mixin
'
;
const
validations
=
{
resetAccount
:
{
...
...
@@ -22,7 +22,7 @@ interface ResetAccount {
@
Component
({
validations
,
})
export
default
class
ResetPasswordInit
extends
mixins
(
A
dmin
Mixin
)
{
export
default
class
ResetPasswordInit
extends
mixins
(
A
ccount
Mixin
)
{
public
success
:
boolean
=
null
;
public
error
:
string
=
null
;
public
resetAccount
:
ResetAccount
=
{
...
...
src/main/webapp/i18n/fr/error.json
View file @
1dd41086
...
...
@@ -9,6 +9,7 @@
"500"
:
"Erreur interne du serveur."
},
"concurrencyFailure"
:
"Un autre utilisateur a modifié ces données en même temps que vous. Vos changements n'ont pas été sauvegardés."
,
"validation"
:
"Erreur de validation côté serveur."
"validation"
:
"Erreur de validation côté serveur."
,
"home"
:
"Page d'accueil"
}
}
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