@@ -21,7 +21,7 @@ func NewAuthController(DB *gorm.DB) AuthController {
21
21
return AuthController {DB }
22
22
}
23
23
24
- // SignUp User
24
+ //[...] SignUp User
25
25
func (ac * AuthController )SignUpUser (ctx * gin.Context ) {
26
26
var payload * models.SignUpInput
27
27
@@ -91,6 +91,7 @@ func (ac *AuthController) SignUpUser(ctx *gin.Context) {
91
91
ctx .JSON (http .StatusCreated , gin.H {"status" :"success" ,"message" :message })
92
92
}
93
93
94
+ // [...] SignIn User
94
95
func (ac * AuthController )SignInUser (ctx * gin.Context ) {
95
96
var payload * models.SignInInput
96
97
@@ -106,6 +107,11 @@ func (ac *AuthController) SignInUser(ctx *gin.Context) {
106
107
return
107
108
}
108
109
110
+ if ! user .Verified {
111
+ ctx .JSON (http .StatusForbidden , gin.H {"status" :"fail" ,"message" :"Please verify your email" })
112
+ return
113
+ }
114
+
109
115
if err := utils .VerifyPassword (user .Password ,payload .Password );err != nil {
110
116
ctx .JSON (http .StatusBadRequest , gin.H {"status" :"fail" ,"message" :"Invalid email or Password" })
111
117
return
@@ -125,11 +131,13 @@ func (ac *AuthController) SignInUser(ctx *gin.Context) {
125
131
ctx .JSON (http .StatusOK , gin.H {"status" :"success" ,"token" :token })
126
132
}
127
133
134
+ // [...] SignOut User
128
135
func (ac * AuthController )LogoutUser (ctx * gin.Context ) {
129
136
ctx .SetCookie ("token" ,"" ,- 1 ,"/" ,"localhost" ,false ,true )
130
137
ctx .JSON (http .StatusOK , gin.H {"status" :"success" })
131
138
}
132
139
140
+ // [...] Verify Email
133
141
func (ac * AuthController )VerifyEmail (ctx * gin.Context ) {
134
142
135
143
code := ctx .Params .ByName ("verificationCode" )