diff --git a/app/controllers/account.go b/app/controllers/account.go index 0b409b3..22c1b10 100644 --- a/app/controllers/account.go +++ b/app/controllers/account.go @@ -320,7 +320,7 @@ func (c Account) PasswordReset(token string) r.Result { // Log user in, flash message and redirect to change password page c.DoLogin(existingProfile.User, false) c.Flash.Success("Please now enter a new password") - return c.Redirect(routes.Profile.Password(existingProfile.UserName)) + return c.Redirect(routes.Profile.Password()) } func (c Account) Logout() r.Result { @@ -461,7 +461,7 @@ func (e Account) sendEmail(user *models.User, verifyType, subject string) error // send mail - t, tErr := template.ParseFiles("email/" + verifyType) + t, tErr := template.ParseFiles("views/email/" + verifyType + ".txt") if tErr != nil { return tErr } @@ -479,7 +479,7 @@ func (e Account) sendEmail(user *models.User, verifyType, subject string) error mailerAuth := smtp.PlainAuth("", mailerUsername, mailerPassword, mailerServer) - if sErr := smtp.SendMail(mailerServer + fmt.Sprintf("%v", mailerPort), mailerAuth, mailerFromAddr, []string{user.Email}, mailerMessage); sErr != nil { + if sErr := smtp.SendMail(mailerServer + fmt.Sprintf(":%v", mailerPort), mailerAuth, mailerFromAddr, []string{user.Email}, mailerMessage); sErr != nil { return sErr } diff --git a/app/controllers/app.go b/app/controllers/app.go index 17f6165..a98effb 100644 --- a/app/controllers/app.go +++ b/app/controllers/app.go @@ -70,7 +70,7 @@ func (c Application) SwitchToDesktop() r.Result { // Add desktop mode cookie c.Session["desktopmode"] = "1" - referer, err := url.Parse(c.Request.Request.Header.Get("Referer")) + referer, err := url.Parse(c.Request.Header.Get("Referer")) if err != nil || referer.String() == "" { return c.Redirect(routes.Application.Index()) } @@ -82,7 +82,7 @@ func (c Application) SwitchToMobile() r.Result { // Remove desktop mode cookie delete(c.Session, "desktopmode") - referer, err := url.Parse(c.Request.Request.Header.Get("Referer")) + referer, err := url.Parse(c.Request.Header.Get("Referer")) if err != nil || referer.String() == "" { return c.Redirect(routes.Application.Index()) } diff --git a/app/controllers/profile.go b/app/controllers/profile.go index 1435274..62e1db5 100644 --- a/app/controllers/profile.go +++ b/app/controllers/profile.go @@ -191,14 +191,17 @@ func (c Profile) UpdateSettings(username string, profile *models.Profile, verify return c.Redirect(routes.Profile.Show(existingProfile.UserName)) } -func (c Profile) Password(username string) r.Result { +// FIXME This is broken. The password is not actually reset. +//func (c Profile) Password(username string) r.Result { +func (c Profile) Password() r.Result { + //profile := c.getProfileByUserName(username) + //user := profile.User profile := c.connected() - if profile == nil || profile.UserName != username { + if profile == nil { c.Flash.Error("You must log in to access your account") return c.Redirect(routes.Account.Logout()) } - - return c.Render() + return c.Render(profile) } func (c Profile) CommitPassword(user *models.User, password string) error { diff --git a/app/views/email/reset.html b/app/views/email/reset.html index 0d4dfed..2380770 100644 --- a/app/views/email/reset.html +++ b/app/views/email/reset.html @@ -1,5 +1,3 @@ -

Hello {{.user.Name}}

-

Please click the link below to reset your password:

-{{.Link}} \ No newline at end of file +{{.Link}} diff --git a/app/views/email/reset.txt b/app/views/email/reset.txt index 76209de..bdd752d 100644 --- a/app/views/email/reset.txt +++ b/app/views/email/reset.txt @@ -1,5 +1,3 @@ -Hello {{.user.Name}}, - Please click the link below to reset your password: -{{.Link}} \ No newline at end of file +{{.Link}} diff --git a/app/views/header.html b/app/views/header.html index 8fc9db3..ad37795 100644 --- a/app/views/header.html +++ b/app/views/header.html @@ -78,8 +78,8 @@
- Profile Photo - {{.user.Name}} + Profile Photo + {{.profile.Name}}
@@ -87,8 +87,8 @@ diff --git a/app/views/profile/password.html b/app/views/profile/password.html index 517a530..cf84847 100644 --- a/app/views/profile/password.html +++ b/app/views/profile/password.html @@ -10,7 +10,7 @@

Reset your password


-
+ {{with $field := field "password" .}}
@@ -38,7 +38,7 @@

Reset your password

diff --git a/vendor/github.com/revel/modules/jobs/app/controllers/status.go b/vendor/github.com/revel/modules/jobs/app/controllers/status.go index 5761329..c339ae2 100644 --- a/vendor/github.com/revel/modules/jobs/app/controllers/status.go +++ b/vendor/github.com/revel/modules/jobs/app/controllers/status.go @@ -15,8 +15,8 @@ type Jobs struct { func (c Jobs) Status() revel.Result { remoteAddress := c.Request.RemoteAddr if revel.Config.BoolDefault("jobs.acceptproxyaddress", false) { - if proxiedAddress, isProxied := c.Request.Header["X-Forwarded-For"]; isProxied { - remoteAddress = proxiedAddress[0] + if proxiedAddress := c.Request.Header.Get("X-Forwarded-For"); proxiedAddress != "" { + remoteAddress = proxiedAddress } } if !strings.HasPrefix(remoteAddress, "127.0.0.1") &&