You've already forked golang-base-project
Added multilanguage support
This commit is contained in:
@ -9,21 +9,15 @@ import (
|
||||
|
||||
// ResendActivation renders the HTML page used to request a new activation email
|
||||
func (controller Controller) ResendActivation(c *gin.Context) {
|
||||
pd := PageData{
|
||||
Title: "Resend Activation Email",
|
||||
IsAuthenticated: isAuthenticated(c),
|
||||
CacheParameter: controller.config.CacheParameter,
|
||||
}
|
||||
pd := controller.DefaultPageData(c)
|
||||
pd.Title = pd.Trans("Resend Activation Email")
|
||||
c.HTML(http.StatusOK, "resendactivation.html", pd)
|
||||
}
|
||||
|
||||
// ResendActivationPost handles the post request for requesting a new activation email
|
||||
func (controller Controller) ResendActivationPost(c *gin.Context) {
|
||||
pd := PageData{
|
||||
Title: "Resend Activation Email",
|
||||
IsAuthenticated: isAuthenticated(c),
|
||||
CacheParameter: controller.config.CacheParameter,
|
||||
}
|
||||
pd := controller.DefaultPageData(c)
|
||||
pd.Title = pd.Trans("Resend Activation Email")
|
||||
email := c.PostForm("email")
|
||||
user := models.User{Email: email}
|
||||
res := controller.db.Where(&user).First(&user)
|
||||
@ -36,10 +30,10 @@ func (controller Controller) ResendActivationPost(c *gin.Context) {
|
||||
res = controller.db.Where(&activationToken).First(&activationToken)
|
||||
if res.Error == nil {
|
||||
// If the activation token exists we simply send an email
|
||||
go controller.sendActivationEmail(activationToken.Value, user.Email)
|
||||
go controller.sendActivationEmail(activationToken.Value, user.Email, pd.Trans)
|
||||
} else {
|
||||
// If there is no token then we need to generate a new token
|
||||
go controller.activationEmailHandler(user.ID, user.Email)
|
||||
go controller.activationEmailHandler(user.ID, user.Email, pd.Trans)
|
||||
}
|
||||
} else {
|
||||
log.Println(res.Error)
|
||||
@ -48,7 +42,7 @@ func (controller Controller) ResendActivationPost(c *gin.Context) {
|
||||
// We always return a positive response here to prevent user enumeration and other attacks
|
||||
pd.Messages = append(pd.Messages, Message{
|
||||
Type: "success",
|
||||
Content: "A new activation email has been sent if the account exists and is not already activated. Please remember to check your spam inbox in case the email is not showing in your inbox.",
|
||||
Content: pd.Trans("A new activation email has been sent if the account exists and is not already activated. Please remember to check your spam inbox in case the email is not showing in your inbox."),
|
||||
})
|
||||
c.HTML(http.StatusOK, "resendactivation.html", pd)
|
||||
}
|
||||
|
Reference in New Issue
Block a user