ResetPassword function
(token string, password string, email string)
| 142 | |
| 143 | // ResetPassword function |
| 144 | func (authService *AuthService) ResetPassword(token string, password string, email string) (success bool, err error) { |
| 145 | user := &models.User{} |
| 146 | var userService = UserService{} |
| 147 | err = userService.getCollection().First(bson.M{"passwordResetToken": token, "email": email}, user) |
| 148 | if err != nil { |
| 149 | return false, err |
| 150 | } |
| 151 | if user.PasswordResetExpires.Before(time.Now()) { |
| 152 | return false, errors.New("PasswordResetToken is expired") |
| 153 | } |
| 154 | hash, _ := hashPassword(password) |
| 155 | user.Password = hash |
| 156 | user.PasswordResetToken = "" |
| 157 | err = userService.getCollection().Update(user) |
| 158 | return true, err |
| 159 | } |
| 160 | |
| 161 | // Sso function |
| 162 | func (authService *AuthService) Sso(sso string) (response map[string]string, err error) { |
nothing calls this directly
no test coverage detected