Skip to content

Commit 6c36b04

Browse files
committed
AJAX
1 parent ca1fe15 commit 6c36b04

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

117-AJAX/03/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package main
22

33
import (
44
"fmt"
5-
"github.com/satori/go.uuid"
6-
"golang.org/x/crypto/bcrypt"
75
"html/template"
86
"io/ioutil"
97
"net/http"
108
"time"
9+
10+
uuid "github.com/satori/go.uuid"
11+
"golang.org/x/crypto/bcrypt"
1112
)
1213

1314
type user struct {
@@ -87,7 +88,7 @@ func signup(w http.ResponseWriter, req *http.Request) {
8788
return
8889
}
8990
// create session
90-
sID, _ := uuid.NewV4()
91+
sID := uuid.NewV4()
9192
c := &http.Cookie{
9293
Name: "session",
9394
Value: sID.String(),
@@ -134,7 +135,7 @@ func login(w http.ResponseWriter, req *http.Request) {
134135
return
135136
}
136137
// create session
137-
sID, _ := uuid.NewV4()
138+
sID := uuid.NewV4()
138139
c := &http.Cookie{
139140
Name: "session",
140141
Value: sID.String(),

117-AJAX/03/session.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ package main
22

33
import (
44
"fmt"
5-
"github.com/satori/go.uuid"
65
"net/http"
76
"time"
7+
8+
uuid "github.com/satori/go.uuid"
89
)
910

1011
func getUser(w http.ResponseWriter, req *http.Request) user {
1112
// get cookie
1213
c, err := req.Cookie("session")
1314
if err != nil {
14-
sID, _ := uuid.NewV4()
15+
sID := uuid.NewV4()
1516
c = &http.Cookie{
1617
Name: "session",
1718
Value: sID.String(),

0 commit comments

Comments
 (0)