MCPcopy Create free account
hub / github.com/devinterface/startersaas-go-api / Activate

Method Activate

services/auth.service.go:125–141  ·  view source on GitHub ↗

Activate function

(token string, email string)

Source from the content-addressed store, hash-verified

123
124// Activate function
125func (authService *AuthService) Activate(token string, email string) (success bool, err error) {
126 user := &models.User{}
127 var userService = UserService{}
128 err = userService.getCollection().First(bson.M{"active": false, "confirmationToken": token, "email": email}, user)
129 if err != nil {
130 return false, err
131 }
132 user.Active = true
133 user.ConfirmationToken = ""
134 err = userService.getCollection().Update(user)
135 if err != nil {
136 return false, err
137 }
138
139 go emailService.SendActiveEmail(bson.M{"_id": user.ID})
140 return true, err
141}
142
143// ResetPassword function
144func (authService *AuthService) ResetPassword(token string, password string, email string) (success bool, err error) {

Callers

nothing calls this directly

Calls 3

SendActiveEmailMethod · 0.80
getCollectionMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected