remove profile

This commit is contained in:
Umputun
2018-05-06 15:07:20 -05:00
parent 7870da30c2
commit 0bc88c606b
6 changed files with 9 additions and 18 deletions
+2 -3
View File
@@ -96,8 +96,7 @@ func TestServer_CreateAndGet(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, "<p><strong>test</strong> <em>123</em> http://radio-t.com</p>", comment.Text)
assert.Equal(t, store.User{Name: "developer one", ID: "dev",
Picture: "/api/v1/avatar/remark.image",
Profile: "https://remark42.com", Admin: true, Blocked: false, IP: "ae12fe3b5f129b5cc4cdd2b136b7b7947c4d2741"},
Picture: "/api/v1/avatar/remark.image", Admin: true, Blocked: false, IP: "ae12fe3b5f129b5cc4cdd2b136b7b7947c4d2741"},
comment.User)
t.Logf("%+v", comment)
}
@@ -250,7 +249,7 @@ func TestServer_UserInfo(t *testing.T) {
user := store.User{}
err := json.Unmarshal([]byte(body), &user)
assert.Nil(t, err)
assert.Equal(t, store.User{Name: "developer one", ID: "dev", Profile: "https://remark42.com",
assert.Equal(t, store.User{Name: "developer one", ID: "dev",
Picture: "/api/v1/avatar/remark.image", Admin: true, Blocked: false, IP: ""}, user)
}
-1
View File
@@ -25,7 +25,6 @@ type Authenticator struct {
var devUser = store.User{
ID: "dev",
Name: "developer one",
Profile: "https://remark42.com",
Picture: "/api/v1/avatar/remark.image",
Admin: true,
}
+1 -2
View File
@@ -34,7 +34,7 @@ func TestLogin(t *testing.T) {
u := store.User{}
err = json.Unmarshal(body, &u)
assert.Nil(t, err)
assert.Equal(t, store.User{Name: "blah", ID: "myuser", Picture: "", Profile: "http://blah.com/p.html",
assert.Equal(t, store.User{Name: "blah", ID: "myuser", Picture: "",
Admin: false, Blocked: false, IP: ""}, u)
}
@@ -76,7 +76,6 @@ func mockProvider(t *testing.T, sessStore sessions.Store, loginPort, authPort in
ID: data.value("id"),
Name: data.value("name"),
Picture: data.value("picture"),
Profile: data.value("profile"),
}
return userInfo
},
+4 -7
View File
@@ -24,10 +24,9 @@ func NewGoogle(p Params) Provider {
Store: p.SessionStore,
MapUser: func(data userData, _ []byte) store.User {
userInfo := store.User{
ID: rest.EncodeID("google_" + data.value("email")), // encode email
ID: "google_" + rest.EncodeID(data.value("email")), // encode email
Name: data.value("name"),
Picture: data.value("picture"),
Profile: data.value("profile"),
}
if userInfo.Name == "" {
userInfo.Name = strings.Split(data.value("email"), "@")[0]
@@ -48,10 +47,9 @@ func NewGithub(p Params) Provider {
Store: p.SessionStore,
MapUser: func(data userData, _ []byte) store.User {
userInfo := store.User{
ID: "github_" + data.value("login"),
ID: "github_" + rest.EncodeID(data.value("login")),
Name: data.value("name"),
Picture: data.value("avatar_url"),
Profile: data.value("html_url"),
}
if userInfo.Name == "" {
userInfo.Name = userInfo.ID
@@ -84,7 +82,7 @@ func NewFacebook(p Params) Provider {
Store: p.SessionStore,
MapUser: func(data userData, bdata []byte) store.User {
userInfo := store.User{
ID: "facebook_" + data.value("id"),
ID: "facebook_" + rest.EncodeID(data.value("id")),
Name: data.value("name"),
}
if userInfo.Name == "" {
@@ -114,10 +112,9 @@ func NewDisqus(p Params) Provider {
Store: p.SessionStore,
MapUser: func(data userData, _ []byte) store.User {
userInfo := store.User{
ID: "disqus_" + data.value("login"),
ID: "disqus_" + rest.EncodeID(data.value("login")),
Name: data.value("name"),
Picture: data.value("avatar_url"),
Profile: data.value("html_url"),
}
if userInfo.Name == "" {
userInfo.Name = userInfo.ID
-2
View File
@@ -39,7 +39,6 @@ type User struct {
Name string `json:"name"`
ID string `json:"id"`
Picture string `json:"picture"`
Profile string `json:"profile,omitempty"`
Admin bool `json:"admin"`
Blocked bool `json:"block,omitempty"`
IP string `json:"ip,omitempty"`
@@ -92,7 +91,6 @@ func (c *Comment) sanitize() {
c.User.ID = template.HTMLEscapeString(c.User.ID)
c.User.Name = template.HTMLEscapeString(c.User.Name)
c.User.Picture = p.Sanitize(c.User.Picture)
c.User.Profile = p.Sanitize(c.User.Profile)
c.Text = strings.Replace(c.Text, "\n", "", -1)
c.Text = strings.Replace(c.Text, "\t", "", -1)
+2 -3
View File
@@ -15,8 +15,8 @@ services:
max-file: "5"
# uncomment to expose directly (no proxy)
ports:
- "80:8080"
#ports:
# - "80:8080"
environment:
# - REMARK_URL=https://demo.remark42.com
@@ -39,5 +39,4 @@ services:
- ./var:/srv/var
#- ./web:/srv/web # uncomment to map web directory directly. It will propagate local changes to container without redeploy
# user: ${USER} # if local UID != 1001 (default) set `USER` in your env, i.e. export USER=`id -u $USER`
command: /srv/start.sh