fix(app): 🚑 resolve profile issue

master
Xeronith 2022-10-25 21:02:23 +03:30
rodzic 8e55c8e72a
commit 57af3d2fb6
4 zmienionych plików z 37 dodań i 18 usunięć

Wyświetl plik

@ -33,17 +33,17 @@ type VerifyResponse struct {
type User struct {
ID uint `json:"id"`
Username string `json:"username"`
DisplayName string `json:"display_name,omitempty"`
DisplayName string `json:"display_name"`
Email string `json:"email"`
Password string `json:"-"`
Bio string `json:"bio,omitempty"`
Github string `json:"github,omitempty"`
Avatar string `json:"avatar,omitempty"`
Banner string `json:"banner,omitempty"`
ApiKey string `json:"api_key,omitempty"`
PublicKey string `json:"public_key,omitempty"`
Actor string `json:"actor,omitempty"`
Webfinger string `json:"webfinger,omitempty"`
Bio string `json:"bio"`
Github string `json:"github"`
Avatar string `json:"avatar"`
Banner string `json:"banner"`
ApiKey string `json:"api_key"`
PublicKey string `json:"public_key"`
Actor string `json:"actor"`
Webfinger string `json:"webfinger"`
PrivateProfile bool `json:"private_profile"`
} // @name User

Wyświetl plik

@ -66,7 +66,7 @@ var UpdateProfile = route.New(HttpPost, "/api/v1/profile", func(x IContext) erro
}
if err := repos.Default.UpdateProfile(user.ID,
Values{
map[string]interface{}{
"display_name": body.DisplayName,
"bio": body.Bio,
"github": body.Github,

Wyświetl plik

@ -55,7 +55,12 @@
<form id="frmSignup" action="/api/v1/signup" method="post">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" name="username" id="username" class="form-control" />
<input
type="text"
name="username"
id="username"
class="form-control"
/>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
@ -123,8 +128,24 @@
},
})
.then(function (response) {
localStorage.setItem("token", response.data.auth.token);
window.location.href = "/profile";
axios({
method: "post",
url: "/api/v1/verify",
data: {
email: document.getElementById("email").value,
code: response.data.code,
},
})
.then(function (response) {
localStorage.setItem("token", response.data.auth.token);
window.location.href = "/profile";
})
.catch(function (err) {
document.getElementById("signupMessage").innerHTML =
err.response.data;
document.getElementById("signupMessage").style.display =
"block";
});
})
.catch(function (err) {
document.getElementById("signupMessage").innerHTML =

Wyświetl plik

@ -8,11 +8,9 @@ import (
"gorm.io/gorm"
)
type Access int64
const (
ACCESS_PUBLIC Access = iota
ACCESS_PRIVATE
ACCESS_PUBLIC = 0
ACCESS_PRIVATE = 1
)
// User struct defines the user
@ -29,7 +27,7 @@ type User struct {
PublicKey string
Avatar string
Banner string
Access Access
Access int
}
// CreateUser create a user entry in the user's table