quzuu-api-dev / controller /auth /auth_change_password_controller.go
lifedebugger's picture
Deploy files from GitHub repository
e762600
raw
history blame contribute delete
749 Bytes
package auth
import (
"github.com/gin-gonic/gin"
"godp.abdanhafidz.com/controller"
"godp.abdanhafidz.com/models"
"godp.abdanhafidz.com/services"
)
func ChangePassword(c *gin.Context) {
authentication := services.AuthenticationService{}
changePasswordController := controller.Controller[models.ChangePasswordRequest, models.Account, models.AuthenticatedUser]{
Service: &authentication.Service,
}
changePasswordController.HeaderParse(c, func() {
changePasswordController.Service.Constructor.Id = changePasswordController.AccountData.UserID
})
changePasswordController.RequestJSON(c, func() {
authentication.Update(changePasswordController.Request.OldPassword, changePasswordController.Request.NewPassword)
})
}