Generator-jhipster: On session expired , Login modal window does not open

Created on 28 Apr 2017  路  6Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

On session expired, Jhipster doesn't correctly manage the use case and doesn't open the login modal due to error in javascript .

Reproduce the error

Change the expiration of the token to a short delay.
You authenticate on Jhipster
You wait the delay
You open for exemple Audit in the Administration menu.

Suggest a Fix

It seems that storeDestinationState method is never called onStateStorageService to set the destination.
The error in the Chrome console is :

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'destination' of null
TypeError: Cannot read property 'destination' of null
    at AuthService.authThen (auth.service.ts:25)
JHipster Version(s)
[email protected] C:\kids\workspace\jhipster4.3
`-- [email protected]

**JHipster configuration, a .yo-rc.json file generated in the root folde

r**

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.mycompany.myapp",
      "nativeLanguage": "fr"
    },
    "jhipsterVersion": "4.3.0",
    "baseName": "jhipster",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "jwtSecretKey": "d09b10ea7671b78bf26e0be3cbfc76435a566bdb",
    "clientFramework": "angular2",
    "useSass": true,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "fr",
    "languages": [
      "fr"
    ]
  }
}
**Entity configuration(s) entityName.json files generated in the `.jhips

ter` directory**

ls: no such file or directory: .jhipster/*.json

Browsers and Operating System

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

git version 2.9.0.windows.1

node: v6.10.0

npm: 4.5.0

yeoman: 1.8.5

yarn: 0.21.3

Docker version 17.03.0-ce, build 60ccb22

docker-compose version 1.11.2, build f963d76f

Windows 7

Tested on last Chrome version

  • [x] Checking this box is mandatory (this is just to show you read everything)
area

All 6 comments

Could you put a better title?

Probably something similar to #5667, it seems we have some path in code that do not set destination.

I think it's due to the guard refactoring I did some times ago. I have to look at this tonight, if I find a fix i'll tell you

Ok so I managed to figure this out.
For me the "authorize" method in the auth service doesn't make sense as we should use guards to authorize or not a user from accessing a route.
We already do this for protected pages like admin or account, we can also do .a guard that prevent a logged user from accessing to register page.

If the JWT Token has expired we should only call logout() for me and set isAuthenticated to false.

@deepu105 are you ok with this ?

@wmarques we can add that 馃憤

@sendilkumarn Ok i'll work on this :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sdoxsee picture sdoxsee  路  4Comments

dronavallisaikrishna picture dronavallisaikrishna  路  3Comments

DanielFran picture DanielFran  路  3Comments

marcelinobadin picture marcelinobadin  路  3Comments

edvjacek picture edvjacek  路  3Comments