Skip to content

Commit 205acdd

Browse files
committed
fix(server): clear captcha only after a successful command
1 parent 9902916 commit 205acdd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

internal/app/server/handler/user/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ func Create(c *gin.Context) {
3737
return
3838
}
3939

40-
captcha.Clear(data.CaptchaID)
41-
4240
err = command.Bus.Dispatch(messages.New(
4341
create.CommandKey,
4442
&create.CommandAttributes{
@@ -56,6 +54,8 @@ func Create(c *gin.Context) {
5654
return
5755
}
5856

57+
captcha.Clear(data.CaptchaID)
58+
5959
c.JSON(http.StatusCreated, &reply.JSON{
6060
Success: true,
6161
Message: "Account created",

internal/app/server/handler/user/forgot.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ func Forgot(c *gin.Context) {
3737
return
3838
}
3939

40-
captcha.Clear(data.CaptchaID)
41-
4240
err = command.Bus.Dispatch(messages.New(
4341
forgot.CommandKey,
4442
&forgot.CommandAttributes{
@@ -53,6 +51,8 @@ func Forgot(c *gin.Context) {
5351
return
5452
}
5553

54+
captcha.Clear(data.CaptchaID)
55+
5656
c.JSON(http.StatusOK, &reply.JSON{
5757
Success: true,
5858
Message: "Link sent. Please check your inbox",

0 commit comments

Comments
 (0)