Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
added a password confirmation and updated the deps
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Nov 3, 2017
1 parent e68465c commit 93069a0
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 91 deletions.
122 changes: 73 additions & 49 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[constraint]]
branch = "development"
name = "github.com/gobuffalo/buffalo"
version = "0.9.4"
14 changes: 4 additions & 10 deletions actions/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,18 @@ var T *i18n.Translator
// application.
func App() *buffalo.App {
if app == nil {
app = buffalo.Automatic(buffalo.Options{
app = buffalo.New(buffalo.Options{
Env: ENV,
SessionName: "_authrecipe_session",
})

// Automatically save the session if the underlying
// Handler does not return an error.
app.Use(middleware.SessionSaver)

if ENV == "development" {
app.Use(middleware.ParameterLogger)
}

if ENV != "test" {
// Protect against CSRF attacks. https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)
// Remove to disable this.
app.Use(csrf.Middleware)
}
// Protect against CSRF attacks. https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)
// Remove to disable this.
app.Use(csrf.New)

// Wraps each request in a transaction.
// c.Value("tx").(*pop.PopTransaction)
Expand Down
12 changes: 7 additions & 5 deletions actions/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import "github.com/gobuffalo/authrecipe/models"
func (as *ActionSuite) Test_Auth_New() {
res := as.HTML("/signin").Get()
as.Equal(200, res.Code)
as.Contains(res.Body.String(), "Signin")
as.Contains(res.Body.String(), "Sign In")
}

func (as *ActionSuite) Test_Auth_Create() {
u := &models.User{
Email: "mark@example.com",
Password: "password",
Email: "mark@example.com",
Password: "password",
PasswordConfirmation: "password",
}
verrs, err := u.Create(as.DB)
as.NoError(err)
Expand All @@ -34,8 +35,9 @@ func (as *ActionSuite) Test_Auth_Create_UnknownUser() {

func (as *ActionSuite) Test_Auth_Create_BadPassword() {
u := &models.User{
Email: "mark@example.com",
Password: "password",
Email: "mark@example.com",
Password: "password",
PasswordConfirmation: "password",
}
verrs, err := u.Create(as.DB)
as.NoError(err)
Expand Down
5 changes: 3 additions & 2 deletions actions/home_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ func (as *ActionSuite) Test_HomeHandler() {

func (as *ActionSuite) Test_HomeHandler_LoggedIn() {
u := &models.User{
Email: "mark@example.com",
Password: "password",
Email: "mark@example.com",
Password: "password",
PasswordConfirmation: "password",
}
verrs, err := u.Create(as.DB)
as.NoError(err)
Expand Down
Loading

0 comments on commit 93069a0

Please sign in to comment.