1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

everywhere: use different session cookie names

If the user is hosting the dashboard in the same domain as
their blog (with a nginx suburi, for example), the two session
cookies clash; logging into one service logs you out of the other.
With this patch, both have separate names.

Fixes https://gitlab.com/commento/commento-ce/issues/49
This commit is contained in:
Adhityaa
2018-06-20 08:59:55 +05:30
parent 76a286d884
commit ef0f45527a
45 changed files with 189 additions and 282 deletions

View File

@ -30,16 +30,16 @@ func TestCommenterGetByHexEmpty(t *testing.T) {
}
}
func TestCommenterGetBySession(t *testing.T) {
func TestCommenterGetByCommenterToken(t *testing.T) {
failTestOnError(t, setupTestEnv())
commenterHex, _ := commenterNew("test@example.com", "Test", "undefined", "https://example.com/photo.jpg", "google", "")
session, _ := commenterSessionNew()
commenterToken, _ := commenterTokenNew()
commenterSessionUpdate(session, commenterHex)
commenterSessionUpdate(commenterToken, commenterHex)
c, err := commenterGetBySession(session)
c, err := commenterGetByCommenterToken(commenterToken)
if err != nil {
t.Errorf("unexpected error getting commenter by hex: %v", err)
return
@ -51,11 +51,11 @@ func TestCommenterGetBySession(t *testing.T) {
}
}
func TestCommenterGetBySessionEmpty(t *testing.T) {
func TestCommenterGetByCommenterTokenEmpty(t *testing.T) {
failTestOnError(t, setupTestEnv())
if _, err := commenterGetBySession(""); err == nil {
t.Errorf("expected error not found getting commenter with empty session")
if _, err := commenterGetByCommenterToken(""); err == nil {
t.Errorf("expected error not found getting commenter with empty commenterToken")
return
}
}
@ -65,9 +65,9 @@ func TestCommenterGetByName(t *testing.T) {
commenterHex, _ := commenterNew("test@example.com", "Test", "undefined", "https://example.com/photo.jpg", "google", "")
session, _ := commenterSessionNew()
commenterToken, _ := commenterTokenNew()
commenterSessionUpdate(session, commenterHex)
commenterSessionUpdate(commenterToken, commenterHex)
c, err := commenterGetByEmail("google", "test@example.com")
if err != nil {