api-qobiltu-dev / space /controller /user /user_change_password_controller.go
lifedebugger's picture
Deploy files from GitHub repository
34fb971
package user
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
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 = uint(changePasswordController.AccountData.UserID)
})
changePasswordController.RequestJSON(c, func() {
authentication.Update(changePasswordController.Request.OldPassword, changePasswordController.Request.NewPassword)
})
}