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)
|
||||
es.checkError(err)
|
||||
|
||||
// Auth
|
||||
err = c.Auth(auth)
|
||||
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.
|
||||
|
||||
memMap := make(map[string]string)
|
||||
emMap := make(map[string]string)
|
||||
|
||||
str, err := json.Marshal(e)
|
||||
|
||||
|
@ -182,9 +181,19 @@ func (es *EmailService) CheckAuthURL(e *Email) bool {
|
|||
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{}
|
||||
json.Unmarshal([]byte(re), tempEmail)
|
||||
|
||||
|
@ -204,15 +213,7 @@ func (es *EmailService) CheckAuthURL(e *Email) bool {
|
|||
}
|
||||
|
||||
func (es *EmailService) modifyEmailAuth(e *Email) {
|
||||
memMap := make(map[string]string)
|
||||
emMap := es.getEmailMap(e)
|
||||
|
||||
str, err := json.Marshal(e)
|
||||
|
||||
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)
|
||||
proxy.InvokeDB("emailAuth", "update", emMap)
|
||||
}
|
Loading…
Reference in New Issue
Block a user