File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,25 @@ func VerifyOTP(c echo.Context) error {
347347
348348func ResendOTP (c echo.Context ) error {
349349 ctx := c .Request ().Context ()
350+
350351 var req models.ResendOTP
352+ if err := c .Bind (& req ); err != nil {
353+ logger .Errorf (logger .InternalError , err .Error ())
354+ return c .JSON (http .StatusBadRequest , & models.Response {
355+ Status : "fail" ,
356+ Message : "Invalid request body" ,
357+ })
358+ }
359+
360+ if err := utils .Validate .Struct (req ); err != nil {
361+ logger .Errorf (logger .InternalError , err .Error ())
362+ return c .JSON (http .StatusBadRequest , & models.Response {
363+ Status : "fail" ,
364+ Message : "Validation errors" ,
365+ Data : utils .FormatValidationErrors (err ),
366+ })
367+ }
368+
351369 err := utils .GenerateOTP (ctx , req .Email )
352370 if err != nil {
353371 logger .Errorf (logger .InternalError , err .Error ())
You can’t perform that action at this time.
0 commit comments