mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #1096 from gradido/login_call_logout
login_call_logout
This commit is contained in:
commit
b54558fa68
@ -263,13 +263,13 @@ export class UserResolver {
|
|||||||
|
|
||||||
@Authorized()
|
@Authorized()
|
||||||
@Query(() => String)
|
@Query(() => String)
|
||||||
async logout(@Ctx() context: any): Promise<string> {
|
async logout(): Promise<boolean> {
|
||||||
const payload = { session_id: context.sessionId }
|
// TODO: We dont need this anymore, but might need this in the future in oder to invalidate a valid JWT-Token.
|
||||||
const result = await apiPost(CONFIG.LOGIN_API_URL + 'logout', payload)
|
// Furthermore this hook can be useful for tracking user behaviour (did he logout or not? Warn him if he didn't on next login)
|
||||||
if (!result.success) {
|
// The functionality is fully client side - the client just needs to delete his token with the current implementation.
|
||||||
throw new Error(result.data)
|
// we could try to force this by sending `token: null` or `token: ''` with this call. But since it bares no real security
|
||||||
}
|
// we should just return true for now.
|
||||||
return 'success'
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mutation(() => String)
|
@Mutation(() => String)
|
||||||
@ -574,7 +574,6 @@ export class UserResolver {
|
|||||||
@Authorized()
|
@Authorized()
|
||||||
@Query(() => Boolean)
|
@Query(() => Boolean)
|
||||||
async hasElopage(@Ctx() context: any): Promise<boolean> {
|
async hasElopage(@Ctx() context: any): Promise<boolean> {
|
||||||
// const result = await apiGet(CONFIG.LOGIN_API_URL + 'hasElopage?session_id=' + context.sessionId)
|
|
||||||
const userRepository = getCustomRepository(UserRepository)
|
const userRepository = getCustomRepository(UserRepository)
|
||||||
const userEntity = await userRepository.findByPubkeyHex(context.pubKey).catch()
|
const userEntity = await userRepository.findByPubkeyHex(context.pubKey).catch()
|
||||||
if (!userEntity) {
|
if (!userEntity) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user