ddd
This commit is contained in:
parent
b511e5dfca
commit
88773a6a68
@ -125,6 +125,7 @@ func (es *EmailService)SendEmailForAuth(e *Email) (error){
|
|||||||
|
|
||||||
c, err := smtp.NewClient(conn, host)
|
c, err := smtp.NewClient(conn, host)
|
||||||
es.checkError(err)
|
es.checkError(err)
|
||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
err = c.Auth(auth)
|
err = c.Auth(auth)
|
||||||
es.checkError(err)
|
es.checkError(err)
|
||||||
@ -170,11 +171,9 @@ func (es *EmailService) saveEmail(e *Email) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (es *EmailService) CheckAuthURL(e *Email) bool {
|
func (es *EmailService) getEmailMap(e *Email) map[string]string {
|
||||||
|
|
||||||
//Todo Query from the database with an authentication token.
|
emMap := make(map[string]string)
|
||||||
|
|
||||||
memMap := make(map[string]string)
|
|
||||||
|
|
||||||
str, err := json.Marshal(e)
|
str, err := json.Marshal(e)
|
||||||
|
|
||||||
@ -182,9 +181,19 @@ func (es *EmailService) CheckAuthURL(e *Email) bool {
|
|||||||
log.Fatal("Json Marshal Error: ", err)
|
log.Fatal("Json Marshal Error: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
memMap["com.loafle.overflow.email.model.EmailAuth"] = string(str)
|
emMap["com.loafle.overflow.email.model.EmailAuth"] = string(str)
|
||||||
|
|
||||||
|
return emMap
|
||||||
|
}
|
||||||
|
|
||||||
|
func (es *EmailService) CheckAuthURL(e *Email) bool {
|
||||||
|
|
||||||
|
//Todo Query from the database with an authentication token.
|
||||||
|
|
||||||
|
emMap := es.getEmailMap(e)
|
||||||
|
|
||||||
|
re := proxy.InvokeDB("emailAuth", "findByAuthToken", emMap)
|
||||||
|
|
||||||
re := proxy.InvokeDB("emailAuth", "findByAuthToken", memMap)
|
|
||||||
tempEmail := &Email{}
|
tempEmail := &Email{}
|
||||||
json.Unmarshal([]byte(re), tempEmail)
|
json.Unmarshal([]byte(re), tempEmail)
|
||||||
|
|
||||||
@ -204,15 +213,7 @@ func (es *EmailService) CheckAuthURL(e *Email) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (es *EmailService) modifyEmailAuth(e *Email) {
|
func (es *EmailService) modifyEmailAuth(e *Email) {
|
||||||
memMap := make(map[string]string)
|
emMap := es.getEmailMap(e)
|
||||||
|
|
||||||
str, err := json.Marshal(e)
|
proxy.InvokeDB("emailAuth", "update", emMap)
|
||||||
|
|
||||||
fmt.Println(string(str))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Json Marshal Error: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
memMap["com.loafle.overflow.email.model.EmailAuth"] = string(str)
|
|
||||||
proxy.InvokeDB("emailAuth", "update", memMap)
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user