Commit 2a5a0a18 authored by Ghitha Dinan's avatar Ghitha Dinan

user fixing

parent cd0fcace
...@@ -47,6 +47,10 @@ data class Users( ...@@ -47,6 +47,10 @@ data class Users(
@JsonIgnore @JsonIgnore
var confirmedDate: Date? = null, var confirmedDate: Date? = null,
@Column(name = "logged_in")
@JsonIgnore
var loggedIn: Boolean? = false,
@Column(name = "created_at") @Column(name = "created_at")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss", timezone = "GMT+7") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss", timezone = "GMT+7")
var createdAt: Date? = Date(), var createdAt: Date? = Date(),
...@@ -55,6 +59,9 @@ data class Users( ...@@ -55,6 +59,9 @@ data class Users(
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss", timezone = "GMT+7") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss", timezone = "GMT+7")
var updatedAt: Date? = Date(), var updatedAt: Date? = Date(),
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss", timezone = "GMT+7")
var lastLogin: Date? = Date(),
@Column(name = "active") @Column(name = "active")
@JsonIgnore @JsonIgnore
var active: Boolean? = true var active: Boolean? = true
......
package id.co.sangkuriang.inovasi.daerah.master.utility package id.co.sangkuriang.inovasi.daerah.master.utility
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.ObjectMapper
import id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_ICON_APPLICATION_CATEGORY_DIR import id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_ICON_APPLICATION_CATEGORY_DIR
import id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_IMAGE_APPLICATION_CATEGORY_DIR import id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_IMAGE_APPLICATION_CATEGORY_DIR
...@@ -19,7 +20,9 @@ import javax.servlet.http.HttpServletRequest ...@@ -19,7 +20,9 @@ import javax.servlet.http.HttpServletRequest
fun getUsersLogin(): Users? { fun getUsersLogin(): Users? {
return try { return try {
val principal = SecurityContextHolder.getContext().authentication.principal as Any val principal = SecurityContextHolder.getContext().authentication.principal as Any
ObjectMapper().readValue(principal.toString(), Users::class.java) val objectMapper = ObjectMapper()
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
objectMapper.readValue(principal.toString(), Users::class.java)
} catch (e: Exception) { } catch (e: Exception) {
null null
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment