diff --git a/controllers/resource.go b/controllers/resource.go index b697c4d6..5156ae9a 100644 --- a/controllers/resource.go +++ b/controllers/resource.go @@ -207,7 +207,7 @@ func (c *ApiController) UploadResource() { } fullFilePath = object.GetTruncatedPath(provider, fullFilePath, 175) - if tag != "avatar" && tag != "termsOfUse" { + if tag != "avatar" && tag != "termsOfUse" && !strings.HasPrefix(tag, "idCard") { ext := filepath.Ext(filepath.Base(fullFilePath)) index := len(fullFilePath) - len(ext) for i := 1; ; i++ { @@ -307,6 +307,25 @@ func (c *ApiController) UploadResource() { c.ResponseError(err.Error()) return } + case "idCardFront", "idCardBack", "idCardWithPerson": + user, err := object.GetUserNoCheck(util.GetId(owner, username)) + if err != nil { + c.ResponseError(err.Error()) + return + } + + if user == nil { + c.ResponseError(c.T("resource:User is nil for tag: avatar")) + return + } + + user.Properties[tag] = fileUrl + user.Properties["isIdCardVerified"] = "false" + _, err = object.UpdateUser(user.GetId(), user, []string{"properties"}, false) + if err != nil { + c.ResponseError(err.Error()) + return + } } c.ResponseOk(fileUrl, objectKey) diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js index 6e8982aa..5c2003b8 100644 --- a/web/src/UserEditPage.js +++ b/web/src/UserEditPage.js @@ -53,6 +53,8 @@ class UserEditPage extends React.Component { mode: props.location.mode !== undefined ? props.location.mode : "edit", loading: true, returnUrl: null, + idCardInfo: ["ID card front", "ID card back", "ID card with person"], + idCardKey: ["idCardFront", "idCardBack", "idCardWithPerson"], }; } @@ -269,6 +271,12 @@ class UserEditPage extends React.Component { } } + if (accountItem.name === "ID card info" || accountItem.name === "ID card") { + if (this.state.user.properties?.isIdCardVerified === "true") { + disabled = true; + } + } + let isKeysGenerated = false; if (this.state.user.accessKey !== "" && this.state.user.accessKey !== "") { isKeysGenerated = true; @@ -365,20 +373,11 @@ class UserEditPage extends React.Component {