Giter Site home page Giter Site logo

gobuffalo / buffalo-auth Goto Github PK

View Code? Open in Web Editor NEW
41.0 8.0 28.0 2.04 MB

Buffalo auth plugin helps adding username password authentication to your app

Home Page: https://gobuffalo.io

License: MIT License

Go 79.41% HTML 17.53% Makefile 3.06%
gobuffalo plugin generator golang go authentication

buffalo-auth's Introduction

Auth Generator for Buffalo

Standard Test Go Reference Go Report Card

Installation

$ buffalo plugins install github.com/gobuffalo/buffalo-auth@latest

Usage

To generate a basic username / password authentication you can run:

$ buffalo generate auth

This will do:

  • Generate User authentication actions in actions/auth.go:

    • AuthNew
    • AuthCreate
    • AuthDestroy
  • Generate User signup actions in actions/users.go:

    • UsersNew
    • UsersCreate
  • Generate User model and migration ( model will be in models/user.go):

  • Generate Auth Middlewares

    • SetCurrentUser
    • Authorize
  • Add actions and middlewares in app.go:

    • [GET] /users/new -> UsersNew
    • [POST] /users -> UsersCreate
    • [GET] /signin -> AuthNew
    • [POST] /signin -> AuthCreate
    • [DELETE] /signout -> AuthDestroy
  • Use middlewares for all your actions and skip

    • HomeHandler
    • UsersNew
    • UsersCreate
    • AuthNew
    • AuthCreate

User model Fields

Sometimes you would want to add extra fields to the user model, to do so, you can pass those to the auth command and use the pop notation for those fields, for example:

$ buffalo generate auth first_name last_name notes:text

Will generate a User model (inside models/user.go) that looks like:

type User struct {
  ID                   uuid.UUID `json:"id" db:"id"`
  CreatedAt            time.Time `json:"created_at" db:"created_at"`
  UpdatedAt            time.Time `json:"updated_at" db:"updated_at"`
  Email                string    `json:"email" db:"email"`
  PasswordHash         string    `json:"password_hash" db:"password_hash"`
  FirstName            string    `json:"first_name" db:"first_name"`
  LastName             string    `json:"last_name" db:"last_name"`
  Notes                string    `json:"notes" db:"notes"`
  Password             string    `json:"-" db:"-"`
  PasswordConfirmation string    `json:"-" db:"-"`
}

buffalo-auth's People

Contributors

baccenfutter avatar bryanmoslo avatar draco2003 avatar imorti avatar jdolitsky avatar lukasschlueter avatar markbates avatar mclark4386 avatar paganotoni avatar pctj101 avatar rabble avatar ricardoseriani avatar robbyoconnor avatar sio4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buffalo-auth's Issues

user signup fails if User struct has pop relationship

Just like the title says, let's say you have a user struct, and add a pop relationship (in this case from model SmartcarToken):

type User struct {
	ID           uuid.UUID `json:"id" db:"id"`
	CreatedAt    time.Time `json:"created_at" db:"created_at"`
	UpdatedAt    time.Time `json:"updated_at" db:"updated_at"`
	Email        string    `json:"email" db:"email"`
	PasswordHash string    `json:"password_hash" db:"password_hash"`

	SmartcarToken SmartcarToken `has_one:"smartcar_tokens" fk_id:"user_id"`

	Password             string `json:"-" db:"-"`
	PasswordConfirmation string `json:"-" db:"-"`
}

you get this error:

reflect: call of reflect.Value.Interface on zero Value

[Bug] Cannot install the plugin with buffalo 0.14.9

With versione 0.14.7 I don't have any issue. Now with the updated version 0.14.9 i get this error when install this plugin:

ERRO[0005] [PLUGIN] error loading plugin /home/badstorm/go/bin/buffalo-pop: signal: killed

Those are the setps that i made:

$ buffalo new myapp
$ cd myapp
$ go get -u github.com/gobuffalo/buffalo-auth
$ buffalo plugins install github.com/gobuffalo/buffalo-auth
And i get the error above.

Proposed change to `buffalo g auth` default template in `app.go`

Propose the following changes to handlers which are being automatically added to app.go file. Currently lines are:

//AuthMiddlewares
app.Use(SetCurrentUser)
app.Use(Authorize)

//Routes for Auth
auth := app.Group("/auth")

auth.GET("/", AuthLanding)
auth.GET("/new", AuthNew)
auth.POST("/", AuthCreate)
auth.DELETE("/", AuthDestroy)
auth.Middleware.Skip(Authorize, AuthLanding, AuthNew, AuthCreate)

//Routes for User registration
users := app.Group("/users")

users.GET("/new", UsersNew)
users.POST("/", UsersCreate)
users.Middleware.Remove(Authorize)

In order to default HomeHandler to work properly suggest adding a middleware skip:

//AuthMiddlewares
app.Use(SetCurrentUser)
app.Use(Authorize)
app.Middleware.Skip(Authorize, HomeHandler)

Also login behaviour (create user -> try to login) - causes error ('auth/new does not exist'). Suggest replacing auth.POST("/", AuthCreate) with auth.POST("/new", AuthCreate)

Unfortunately, I am a newbie so still do not know how to change tests to make them pass on these changes...

Buffalo-auth fails to go-get, no component to generate

When I try to install bufallo-auth:

go get -u github.com/gobuffalo/buffalo-auth

...
go: downloading golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
go: finding github.com/gobuffalo/genny/movinglater/plushgen latest
go: finding github.com/gobuffalo/genny/movinglater latest
go build github.com/gobuffalo/genny/movinglater/plushgen: no Go files in 

buffalo g auth > Shows buffalo generate help menu without any mention of auth.

I am using go modules (GO111MODULE=on) and running the first command in my project directory.

go version: go version go1.11.5 linux/amd64

buffalo version: Buffalo version is: v0.14.0

user_test.go Tests Fail | undefined: ModelSuite

Hi! I’ve installed the buffalo-auth plugin using the command go getgithub.com/gobuffalo/buffalo-auth. This completes properly and the buffalo-auth command runs properly from my $PATH.

I've run the buffalo-auth auth command against my project and this has generated proper auth structure; however, when running the default tests which are generated its throwing multiple errors:

$GOPATH/src/coke/models/user_test.go:7:11: undefined: ModelSuite
$GOPATH/src/coke/models/user_test.go:29:11: undefined: ModelSuite
$GOPATH/src/coke/models/user_test.go:48:11: undefined: ModelSuite

Looking at the default code which is generated, the test functions are passing in the argument (ms *ModelSuite) but this is not defined in a location that the test is aware of.

I've been able to resolve this issue by modifying the default code to include the ModelSuite struct.
Original Code generated by buffalo-auth:

package models_test

import (
	"coke/models"
)

func (ms *ModelSuite) Test_User_Create() {
	count, err := ms.DB.Count("users")
	ms.NoError(err)
	ms.Equal(0, count)

	u := &models.User{
		Email:                "[email protected]",
		Password:             "password",
		PasswordConfirmation: "password",
	}
	ms.Zero(u.PasswordHash)

	verrs, err := u.Create(ms.DB)
	ms.NoError(err)
	ms.False(verrs.HasAny())
	ms.NotZero(u.PasswordHash)

	count, err = ms.DB.Count("users")
	ms.NoError(err)
	ms.Equal(1, count)
}

[... SNIP ...]

Fixed code which addresses the undefined condition and allows tests to run properly and pass. The primary additions are defining the struct and adding the additional import line.

package models_test

import (
	"coke/models"

	"github.com/gobuffalo/suite"
)

type ModelSuite struct {
	*suite.Model
}

func (ms *ModelSuite) Test_User_Create() {
	count, err := ms.DB.Count("users")
	ms.NoError(err)
	ms.Equal(0, count)

	u := &models.User{
		Email:                "[email protected]",
		Password:             "password",
		PasswordConfirmation: "password",
	}
	ms.Zero(u.PasswordHash)

	verrs, err := u.Create(ms.DB)
	ms.NoError(err)
	ms.False(verrs.HasAny())
	ms.NotZero(u.PasswordHash)

	count, err = ms.DB.Count("users")
	ms.NoError(err)
	ms.Equal(1, count)
}

[... SNIP ...]

I'm curious if there is something I've done wrong in the way I've installed the plugin or generated the auth code. Is this something the buffalo-auth auth generator should add to the user_test.go file by default? Any insight on the proper work flow or testing process would be greatly appreciated.

go get error (genny)

Not sure what's happening, but while outside of any particular project, I have an error when go getting this package :

go get -u github.com/gobuffalo/buffalo-auth
# github.com/gobuffalo/buffalo-auth/genny/auth
go/src/github.com/gobuffalo/buffalo-auth/genny/auth/auth.go:59:25: multiple-value meta.New() in single-value context
go/src/github.com/gobuffalo/buffalo-auth/genny/auth/auth.go:59:26: cannot use "." (type string) as type here.Info in argument to meta.New

Then in a project buffalo plugins install github.com/gobuffalo/buffalo-auth exits with the same message and status 2.

On go version go1.13 darwin/amd64 and Buffalo version is: v0.15.4

Any help appreciated, thanks.

Error installing buffalo-auth plugin

Hello! Thank you so much for your interest in Buffalo. The fact you care enough to be here, right now, helping, makes us very happy.

Description

Unable to install buffalo-auth plugin

Steps to Reproduce the Problem

  1. Run buffalo plugins install github.com/gobuffalo/buffalo-auth

Expected Behavior

Should be similar to docs

Actual Behavior

> buffalo plugins install github.com/gobuffalo/buffalo-auth
no required module provides package github.com/gobuffalo/buffalo-auth; to add it:
        go get github.com/gobuffalo/buffalo-auth
Usage:
  buffalo plugins install [flags]

Flags:
  -d, --dry-run   dry run
  -h, --help      help for install
      --vendor    will install plugin binaries into ./plugins [WINDOWS not currently supported]
  -v, --verbose   turn on verbose logging

ERRO[0004] Error: exit status 1

Info

Please run buffalo info and paste the information below where it says "PASTE_HERE".

-> Buffalo: Application Details
Pwd         /mnt/c/Users/intruder/go/src/github.com/karfianto/mypro
Root        /mnt/c/Users/intruder/go/src/github.com/karfianto/mypro
GoPath      /mnt/c/Users/intruder/go
PackagePkg  github.com/karfianto/mypro
ActionsPkg  github.com/karfianto/mypro/actions
ModelsPkg   github.com/karfianto/mypro/models
GriftsPkg   github.com/karfianto/mypro/grifts
WithModules true
Name        mypro
Bin         bin/mypro
VCS         none
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[build:webpack --mode production --progress dev:webpack --watch]}

-> Buffalo: config/buffalo-app.toml
name = "mypro"
bin = "bin/mypro"
vcs = "none"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v2"

attr type didn't work

I generated a new auth with the following command:

$ b g auth age:int bio:nulls.Text

It didn't generate a model using nulls.String or a migration that has the correct column t.Column("bio", "text", {"null": true})

type User struct {
	ID           uuid.UUID `json:"id" db:"id"`
	CreatedAt    time.Time `json:"created_at" db:"created_at"`
	UpdatedAt    time.Time `json:"updated_at" db:"updated_at"`
	Email        string    `json:"email" db:"email"`
	PasswordHash string    `json:"password_hash" db:"password_hash"`

	Password             string `json:"-" db:"-"`
	PasswordConfirmation string `json:"-" db:"-"`

	//Extra fields

	Age string `json:"age" db:"age"`

	Bio string `json:"bio" db:"bio"`
}
create_table("users"){
    t.Column("id", "uuid", {"primary": true})
    t.Column("email", "string", {})
    t.Column("password_hash", "string", {})

     
    t.Column("age", "string", {})
     
    t.Column("bio", "string", {})
    
}

Compatibility issues when integrating with buffalo 0.16.3

Not sure if this is a bug, or I am just doing something wrong. I started a clean setup on ubuntu, with latest buffalo. I implemented localauth as suggested by https://gobuffalo.io/en/docs/auth/. When I start buffalo dev and attempt to sign up a user by going to /users/new it gives me the following when I submit the form:
image

UPD:
I fixed by changing all instances of github.com/gobuffalo/pop to github.com/gobuffalo/pop/v5 and github.com/gobuffalo/validate to github.com/gobuffalo/validate/v3

Can anyone look into this? I am still not sure if this is a bug or a user error

Plugin installation fails

Hello,

Plugin installation fails when running:

$ go get -u github.com/gobuffalo/buffalo-auth
$ buffalo plugins install github.com/gobuffalo/buffalo-auth

go version go1.13 darwin/amd64
Buffalo version is: v0.15.4

go get: error loading module requirements

I am on latest release of Go And Buffalo
Follwing is the output of installation
Is this due to some outdated dependencies???
Following is the output :

go get -u github.com/gobuffalo/buffalo-auth
go: finding github.com/gobuffalo/attrs latest
go: finding github.com/serenize/snaker latest
go: finding golang.org/x/crypto latest
go: finding github.com/gobuffalo/meta latest
go: finding golang.org/x/sync latest
go: finding github.com/gobuffalo/logger latest
go: finding golang.org/x/tools latest
go: finding github.com/gobuffalo/licenser latest
go: finding github.com/markbates/oncer latest
go: finding github.com/sourcegraph/syntaxhighlight latest
go: finding github.com/ugorji/go/codec latest
go: finding golang.org/x/sys latest
go: finding github.com/armon/consul-api latest
go: finding golang.org/x/net latest
go: finding github.com/gobuffalo/gitgen latest
go: finding github.com/sourcegraph/annotate latest
go: finding github.com/gobuffalo/helpers latest
go: finding github.com/gobuffalo/syncx latest
go: finding github.com/google/pprof latest
go: finding gopkg.in/tomb.v1 latest
go: finding gopkg.in/check.v1 latest
go: finding golang.org/x/lint latest
go: finding github.com/shurcooL/highlight_diff latest
go: finding google.golang.org/genproto latest
go: finding github.com/prometheus/procfs latest
go: finding github.com/shurcooL/go latest
go: finding github.com/golang/glog latest
go: finding golang.org/x/oauth2 latest
go: finding golang.org/x/build latest
go: finding github.com/anmitsu/go-shlex latest
go: finding github.com/shurcooL/octicon latest
go: finding github.com/jellevandenhooff/dkim latest
go: finding honnef.co/go/tools latest
go: finding github.com/googleapis/gax-go v2.0.2+incompatible
go: finding github.com/shurcooL/home latest
go: finding github.com/neelance/astrewrite latest
go: finding github.com/tarm/serial latest
go: finding github.com/shurcooL/go-goon latest
go: finding github.com/shurcooL/github_flavored_markdown latest
go: finding github.com/shurcooL/events latest
go: finding dmitri.shuralyov.com/html/belt latest
go: finding dmitri.shuralyov.com/service/change latest
go: finding github.com/shurcooL/notifications latest
go: finding dmitri.shuralyov.com/state latest
go: finding github.com/shurcooL/users latest
go: finding github.com/bradfitz/go-smtpd latest
go: finding github.com/gregjones/httpcache latest
go: finding golang.org/x/time latest
go: finding github.com/shurcooL/highlight_go latest
go: finding github.com/shurcooL/httpgzip latest
go: finding github.com/shurcooL/gofontwoff latest
go: finding github.com/shurcooL/httpfs latest
go: finding github.com/coreos/go-systemd latest
go: finding github.com/shurcooL/httperror latest
go: finding github.com/golang/lint latest
go: finding github.com/flynn/go-shlex latest
go: github.com/golang/[email protected]: parsing go.mod: unexpected module path "golang.org/x/lint"
go: sourcegraph.com/sourcegraph/[email protected]: parsing go.mod: unexpected module path "github.com/sourcegraph/go-diff"
go: finding golang.org/x/tools v0.0.0-20190114222345-bf090417da8b
go: finding github.com/shurcooL/issues latest
go: finding github.com/shurcooL/reactions latest
go: finding github.com/shurcooL/gopherjslib latest
go: finding github.com/shurcooL/issuesapp latest
go: finding golang.org/x/perf latest
go get: error loading module requirements

after installing plugins and buffalo-auth runnning buffalo g auth does nothing

After installing plugins and buffalo-auth, runnning buffalo g auth does nothing on windows. Auth does not show on buffalo plugins list:
$ buffalo g auth
Generate application components

Usage:
buffalo generate [command]

Aliases:
generate, g

Available Commands:
action Generate new action(s)
mailer Generate a new mailer for Buffalo
plugin [PLUGIN] generates a new buffalo plugin
resource Generate a new actions/resource file
task Generate a grift task

Flags:
-h, --help help for generate

Use "buffalo generate [command] --help" for more information about a command.

User Profile

We could generate a simple user profile where users can change the password.

Trim received email

Sometimes users copy paste email with added spaces, we should trim received emails to avoid frustration.

Not possible to install

Please check this problem

command:
go get -u github.com/gobuffalo/buffalo-auth

Output:

go: finding github.com/kballard/go-shellquote latest
go: finding github.com/alecthomas/units latest
go: finding github.com/eapache/go-xerial-snappy latest
go: finding github.com/rcrowley/go-metrics latest
go: finding github.com/gobuffalo/genny/movinglater/plushgen latest
go: finding github.com/gobuffalo/genny/movinglater latest
go build github.com/gobuffalo/genny/movinglater/plushgen: no Go files in 

Cause of the last problem not possible to complete the installation.
OS: Macos mojave

Cheers!

bug: Error running buffalo g auth

Description

-- Please provide as much relevant info as possible. -->

Description

Expected Behavior

Create the scaffold

Actual Behavior

Error running buffalo g auth

got this error message:

% buffalo g auth                                            22-11-25 - 21:54:26
Error: could not find desired block in actions/app.go
Usage:
  buffalo generate auth [flags]

Flags:
  -h, --help   help for auth

ERRO[0000] Error: exit status 1  

To Reproduce

 buffalo new seu-garcom-go --db-type=sqlite3
 cd seu_garcom_go
 buffalo plugins install github.com/gobuffalo/buffalo-auth
 buffalo g auth

Additional Context

Details

-> Go: Checking installation
✓ The `go` executable was found on your system at: /home/j/bin/go/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.19, meets the minimum requirements.

-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.

-> Go: Checking PATH
✓ Your PATH contains /home/j/go/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /home/j/.nvm/versions/node/v14.20.0/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v14.20.0, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /home/j/.nvm/versions/node/v14.20.0/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.14.17, meets the minimum requirements.

-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /home/j/.nvm/versions/node/v14.20.0/bin/yarnpkg

-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 3.3.0, meets the minimum requirements.

-> PostgreSQL: Checking installation
✘ The `postgres` executable could not be found on your system.
For help setting up your Postgres environment please follow the instructions for you platform at:

https://www.postgresql.org/download/

-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:

https://www.mysql.com/downloads/

-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /home/j/Android/Sdk/platform-tools/sqlite3

-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.32.2, meets the minimum requirements.

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /home/j/go/bin/buffalo

-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.18.9, meets the minimum requirements.

-> Buffalo: Application Details
Pwd         /home/j/lab/seu_garcom_go
Root        /home/j/lab/seu_garcom_go
GoPath      /home/j/go
PackagePkg  seu_garcom_go
ActionsPkg  seu_garcom_go/actions
ModelsPkg   seu_garcom_go/models
GriftsPkg   seu_garcom_go/grifts
WithModules true
Name        seu-garcom-go
Bin         bin/seu-garcom-go
VCS         git
WithPop     true
WithSQLite  true
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[build:webpack --mode production --progress dev:webpack --watch]}

-> Buffalo: config/buffalo-app.toml
name = "seu-garcom-go"
bin = "bin/seu-garcom-go"
vcs = "git"
with_pop = true
with_sqlite = true
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-auth"
  go_get = "github.com/gobuffalo/buffalo-auth@latest"
  tags = ["sqlite"]

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
  tags = ["sqlite"]

-> Buffalo: go.mod
module seu_garcom_go

go 1.19

require (
	github.com/gobuffalo/buffalo v1.0.1
	github.com/gobuffalo/buffalo-pop/v3 v3.0.6
	github.com/gobuffalo/envy v1.10.2
	github.com/gobuffalo/grift v1.5.2
	github.com/gobuffalo/mw-csrf v1.0.1
	github.com/gobuffalo/mw-forcessl v1.0.1
	github.com/gobuffalo/mw-i18n/v2 v2.0.2
	github.com/gobuffalo/mw-paramlogger v1.0.1
	github.com/gobuffalo/pop/v6 v6.1.0
	github.com/gobuffalo/suite/v4 v4.0.3
	github.com/unrolled/secure v1.13.0
)

require (
	github.com/BurntSushi/toml v1.2.0 // indirect
	github.com/Masterminds/semver/v3 v3.1.1 // indirect
	github.com/aymerick/douceur v0.2.0 // indirect
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/dustin/go-humanize v1.0.0 // indirect
	github.com/fatih/color v1.13.0 // indirect
	github.com/fatih/structs v1.1.0 // indirect
	github.com/felixge/httpsnoop v1.0.1 // indirect
	github.com/fsnotify/fsnotify v1.5.4 // indirect
	github.com/go-sql-driver/mysql v1.6.0 // indirect
	github.com/gobuffalo/events v1.4.3 // indirect
	github.com/gobuffalo/fizz v1.14.4 // indirect
	github.com/gobuffalo/flect v0.3.0 // indirect
	github.com/gobuffalo/github_flavored_markdown v1.1.3 // indirect
	github.com/gobuffalo/helpers v0.6.7 // indirect
	github.com/gobuffalo/httptest v1.5.2 // indirect
	github.com/gobuffalo/logger v1.0.7 // indirect
	github.com/gobuffalo/meta v0.3.3 // indirect
	github.com/gobuffalo/nulls v0.4.2 // indirect
	github.com/gobuffalo/plush/v4 v4.1.16 // indirect
	github.com/gobuffalo/refresh v1.13.2 // indirect
	github.com/gobuffalo/tags/v3 v3.1.4 // indirect
	github.com/gobuffalo/validate/v3 v3.3.3 // indirect
	github.com/gofrs/uuid v4.3.1+incompatible // indirect
	github.com/gorilla/css v1.0.0 // indirect
	github.com/gorilla/handlers v1.5.1 // indirect
	github.com/gorilla/mux v1.8.0 // indirect
	github.com/gorilla/securecookie v1.1.1 // indirect
	github.com/gorilla/sessions v1.2.1 // indirect
	github.com/inconshreveable/mousetrap v1.0.1 // indirect
	github.com/jackc/chunkreader/v2 v2.0.1 // indirect
	github.com/jackc/pgconn v1.13.0 // indirect
	github.com/jackc/pgio v1.0.0 // indirect
	github.com/jackc/pgpassfile v1.0.0 // indirect
	github.com/jackc/pgproto3/v2 v2.3.1 // indirect
	github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
	github.com/jackc/pgtype v1.12.0 // indirect
	github.com/jackc/pgx/v4 v4.17.2 // indirect
	github.com/jmoiron/sqlx v1.3.5 // indirect
	github.com/joho/godotenv v1.4.0 // indirect
	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
	github.com/luna-duclos/instrumentedsql v1.1.3 // indirect
	github.com/mattn/go-colorable v0.1.9 // indirect
	github.com/mattn/go-isatty v0.0.14 // indirect
	github.com/mattn/go-sqlite3 v1.14.16 // indirect
	github.com/microcosm-cc/bluemonday v1.0.20 // indirect
	github.com/mitchellh/go-homedir v1.1.0 // indirect
	github.com/monoculum/formam v3.5.5+incompatible // indirect
	github.com/nicksnyder/go-i18n v1.10.1 // indirect
	github.com/pelletier/go-toml v1.2.0 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/pmezard/go-difflib v1.0.0 // indirect
	github.com/rogpeppe/go-internal v1.9.0 // indirect
	github.com/sergi/go-diff v1.2.0 // indirect
	github.com/sirupsen/logrus v1.9.0 // indirect
	github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect
	github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
	github.com/spf13/cobra v1.6.1 // indirect
	github.com/spf13/pflag v1.0.5 // indirect
	github.com/stretchr/testify v1.8.1 // indirect
	golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
	golang.org/x/net v0.0.0-20221002022538-bcab6841153b // indirect
	golang.org/x/sync v0.1.0 // indirect
	golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
	golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
	golang.org/x/text v0.3.7 // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
)

Generate html files with .plush.html extensions

Hello Mark, using this great plugin recently I noticed it's still generating .html files, so in order to keep consistency with buffalo last version, I think it would be good if auth command generates .plush.html files. If you agree with my, please check my PR #50

An error during generating basic auth

I try to create an empty project and connect buffalo-auth and got an error:

Error: templates/auth/new.plush.html: line 22: "user": unknown identifier

My steps:

buffalo new app --db-type mysql --skip-yarn
go get -u github.com/gobuffalo/buffalo-auth
buffalo plugins install github.com/gobuffalo/buffalo-auth
buffalo generate auth -h

What am I doing wrong?

Database migration fails on new buffalo project

Hi,

I created a completely empty buffalo project using version v0.13.12. I then followed the guide for buffalo-auth, so:

cd $PROJECT_ROOT
go get -u github.com/gobuffalo/buffalo-auth
buffalo g auth

No problems here. I then tried to migrate the database with:

buffalo pop migrate 

The error I got was:

problem inserting migration version 1547343428200944647: pq: value too long for type character varying(14)

I checked, no table "users" was created, when starting the Dev server I get a 500 response.

I'm running PostgreSQL latest inside docker, any ideas what the problem could be?

Thanks,
Toby

Redirect after login

When a user attempts to visit one of the protected URL's I think we should store this URL on the session so after the user logs in we redirect the user there.

Installation fails on M1

Running buffalo plugins install github.com/gobuffalo/buffalo-auth gives the following error on M1:

# golang.org/x/sys/unix
../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:40:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: too many errors
Usage:
  buffalo plugins install [flags]

Flags:
  -d, --dry-run   dry run
  -h, --help      help for install
      --vendor    will install plugin binaries into ./plugins [WINDOWS not currently supported]
  -v, --verbose   turn on verbose logging

ERRO[0000] Error: exit status 2            

Installed plugin support using: go get -u -v github.com/gobuffalo/buffalo-plugins
Buffalo Version: 0.18.5
Go Version: 1.18.2 darwin/arm64

Adding some parameters to the User

It would be good to have an option to create some other parameters to the user apart of Email, PasswordHash, Password and PasswordConfirmation, from the buffalo generate command, something like:

$ buffalo generate auth first_name last_name address

on that way we don't have to create another migration to add those parameters to the User. What do you think?

Password Recovery

One of the things i would like to add into buffalo auth is password recovery, my intention is to have something like:

$ buffalo g auth password-recovery

That would:

  • Add properties on the User model:
    • PasswordRecoveryToken (nulls.String) property
    • PasswordRecoveryValidUntil (nulls.Time) property
  • Add a method to re-generate PasswordRecoveryToken and ValidUntil on User model.
  • Add 2 actions to actions/auth.go:
    • One to render the password recovery form [GET] /password-recovery
    • One to handle the recovery request, [POST] /password-recovery
  • Add 1 mailer for for the password recovery request that will be used by the recovery request handler.

App failure after running `buffalo g auth`

Steps:

  1. Create app with buffalo new <app name> --db-type=mysql
  2. Edit DB creds then run: buffalo db create -a
  3. I run the app and I can hit the standard home page. then run buffalo g auth.
  4. I run buffalo db migrate.
  5. I run buffalo dev.
  6. Browser pointing at http://localhost:3000 and see error 404 and error below:

sql: no rows in result set
github.com/gobuffalo/pop.genericSelectOne
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect.go:131
github.com/gobuffalo/pop.(*mysql).SelectOne
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect_mysql.go:92
github.com/gobuffalo/pop.(*Query).First.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:77
github.com/gobuffalo/pop.(*Connection).timeFunc
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:199
github.com/gobuffalo/pop.(*Query).First
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:74
github.com/gobuffalo/pop.(*Query).Find
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:43
github.com/gobuffalo/pop.(*Connection).Find
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:25
github.com/imorti/elevation/actions.SetCurrentUser.func1
/Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:48
github.com/gobuffalo/mw-i18n.(*Translator).Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/i18n.go:130
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:52
github.com/gobuffalo/pop.(*Connection).Transaction.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:127
github.com/gobuffalo/pop.(*mysql).Lock
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect_mysql.go:150
github.com/gobuffalo/pop.(*Connection).Transaction
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:121
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:39
github.com/gobuffalo/mw-csrf.glob..func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/csrf.go:120
github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/param_logger.go:63
github.com/gobuffalo/mw-forcessl.Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/forcessl.go:26
github.com/gobuffalo/buffalo.sessionSaver.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/session.go:70
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/request_logger.go:54
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:82
github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:88
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/route_info.go:108
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
:1
github.com/gorilla/mux.(*Router).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:162
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/Users/imorti/work/go/pkg/mod/github.com/markbates/[email protected]/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:1964
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/server.go:126
net/http.serverHandler.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:2741
net/http.(*conn).serve
/usr/local/opt/go/libexec/src/net/http/server.go:1847
runtime.goexit
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333
mysql select one
github.com/gobuffalo/pop.(*mysql).SelectOne
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect_mysql.go:92
github.com/gobuffalo/pop.(*Query).First.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:77
github.com/gobuffalo/pop.(*Connection).timeFunc
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:199
github.com/gobuffalo/pop.(*Query).First
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:74
github.com/gobuffalo/pop.(*Query).Find
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:43
github.com/gobuffalo/pop.(*Connection).Find
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:25
github.com/imorti/elevation/actions.SetCurrentUser.func1
/Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:48
github.com/gobuffalo/mw-i18n.(*Translator).Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/i18n.go:130
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:52
github.com/gobuffalo/pop.(*Connection).Transaction.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:127
github.com/gobuffalo/pop.(*mysql).Lock
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect_mysql.go:150
github.com/gobuffalo/pop.(*Connection).Transaction
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:121
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:39
github.com/gobuffalo/mw-csrf.glob..func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/csrf.go:120
github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/param_logger.go:63
github.com/gobuffalo/mw-forcessl.Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/forcessl.go:26
github.com/gobuffalo/buffalo.sessionSaver.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/session.go:70
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/request_logger.go:54
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:82
github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:88
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/route_info.go:108
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
:1
github.com/gorilla/mux.(*Router).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:162
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/Users/imorti/work/go/pkg/mod/github.com/markbates/[email protected]/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:1964
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/server.go:126
net/http.serverHandler.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:2741
net/http.(*conn).serve
/usr/local/opt/go/libexec/src/net/http/server.go:1847
runtime.goexit
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333
github.com/gobuffalo/pop.(*Connection).timeFunc
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:202
github.com/gobuffalo/pop.(*Query).First
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:74
github.com/gobuffalo/pop.(*Query).Find
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:43
github.com/gobuffalo/pop.(*Connection).Find
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/finders.go:25
github.com/imorti/elevation/actions.SetCurrentUser.func1
/Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:48
github.com/gobuffalo/mw-i18n.(*Translator).Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/i18n.go:130
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:52
github.com/gobuffalo/pop.(*Connection).Transaction.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:127
github.com/gobuffalo/pop.(*mysql).Lock
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect_mysql.go:150
github.com/gobuffalo/pop.(*Connection).Transaction
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:121
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:39
github.com/gobuffalo/mw-csrf.glob..func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/csrf.go:120
github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/param_logger.go:63
github.com/gobuffalo/mw-forcessl.Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/forcessl.go:26
github.com/gobuffalo/buffalo.sessionSaver.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/session.go:70
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/request_logger.go:54
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:82
github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:88
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/route_info.go:108
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
:1
github.com/gorilla/mux.(*Router).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:162
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/Users/imorti/work/go/pkg/mod/github.com/markbates/[email protected]/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:1964
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/server.go:126
net/http.serverHandler.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:2741
net/http.(*conn).serve
/usr/local/opt/go/libexec/src/net/http/server.go:1847
runtime.goexit
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333
github.com/imorti/elevation/actions.SetCurrentUser.func1
/Users/imorti/work/go/src/github.com/imorti/elevation/actions/users.go:50
github.com/gobuffalo/mw-i18n.(*Translator).Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/i18n.go:130
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:52
github.com/gobuffalo/pop.(*Connection).Transaction.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:127
github.com/gobuffalo/pop.(*mysql).Lock
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect_mysql.go:150
github.com/gobuffalo/pop.(*Connection).Transaction
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:121
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:39
github.com/gobuffalo/mw-csrf.glob..func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/csrf.go:120
github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/param_logger.go:63
github.com/gobuffalo/mw-forcessl.Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/forcessl.go:26
github.com/gobuffalo/buffalo.sessionSaver.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/session.go:70
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/request_logger.go:54
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:82
github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:88
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/route_info.go:108
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
:1
github.com/gorilla/mux.(*Router).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:162
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/Users/imorti/work/go/pkg/mod/github.com/markbates/[email protected]/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:1964
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/server.go:126
net/http.serverHandler.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:2741
net/http.(*conn).serve
/usr/local/opt/go/libexec/src/net/http/server.go:1847
runtime.goexit
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333
github.com/gobuffalo/pop.(*Connection).Transaction.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:134
github.com/gobuffalo/pop.(*mysql).Lock
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/dialect_mysql.go:150
github.com/gobuffalo/pop.(*Connection).Transaction
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]+incompatible/connection.go:121
github.com/gobuffalo/buffalo-pop/pop/popmw.Transaction.func2.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/pop/popmw/tx.go:39
github.com/gobuffalo/mw-csrf.glob..func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/csrf.go:120
github.com/gobuffalo/mw-paramlogger.parameterLogger.Middleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/param_logger.go:63
github.com/gobuffalo/mw-forcessl.Middleware.func1.1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/forcessl.go:26
github.com/gobuffalo/buffalo.sessionSaver.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/session.go:70
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/request_logger.go:54
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:82
github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:88
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/route_info.go:108
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
:1
github.com/gorilla/mux.(*Router).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:162
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/Users/imorti/work/go/pkg/mod/github.com/markbates/[email protected]/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:1964
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/server.go:126
net/http.serverHandler.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:2741
net/http.(*conn).serve
/usr/local/opt/go/libexec/src/net/http/server.go:1847
runtime.goexit
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333
github.com/gobuffalo/buffalo.sessionSaver.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/session.go:72
github.com/gobuffalo/buffalo.RequestLoggerFunc.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/request_logger.go:54
github.com/gobuffalo/buffalo.(*App).PanicHandler.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:82
github.com/gobuffalo/buffalo.(*App).defaultErrorMiddleware.func1
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/errors.go:88
github.com/gobuffalo/buffalo.RouteInfo.ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/route_info.go:108
github.com/gobuffalo/buffalo.(*RouteInfo).ServeHTTP
:1
github.com/gorilla/mux.(*Router).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:162
github.com/markbates/refresh/refresh/web.ErrorChecker.func1
/Users/imorti/work/go/pkg/mod/github.com/markbates/[email protected]/refresh/web/web.go:23
net/http.HandlerFunc.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:1964
github.com/gobuffalo/buffalo.(*App).ServeHTTP
/Users/imorti/work/go/pkg/mod/github.com/gobuffalo/[email protected]/server.go:126
net/http.serverHandler.ServeHTTP
/usr/local/opt/go/libexec/src/net/http/server.go:2741
net/http.(*conn).serve
/usr/local/opt/go/libexec/src/net/http/server.go:1847
runtime.goexit
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1333

Plugin does not work "our-of-the-box"

Running the latest gobuffalo (v0.15.3) on Mac Catalina.

Performing the following steps:

  1. buffalo new bauth
    everything is fine
  2. cd bauth
  3. buffalo db create -a
    3 databases created
  4. buffalo plugins install github.com/gobuffalo/buffalo-auth
    ok (no response)
  5. buffalo g auth
    also silent completion
  6. buffalo dev
    server starts up... Everything seems to have started - when accessing via http://localhost:3000/ get the error (TOO_MANY_REDIRECTS) and the following in the console:
INFO[2020-01-02T22:05:48+03:00] Starting application at http://127.0.0.1:3000
INFO[2020-01-02T22:05:48+03:00] Starting Simple Background Worker
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration=86.172695ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-979784a928d312c96013 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration=1.122236ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-647a1ada347589c74d89 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="756.25µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-180cd9a3a9415fa198ce size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="770.587µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-9e91ee7f87884685cd52 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="809.652µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-9d6b9d46fef409eeec69 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="876.247µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-e8c560b9b3f616712e19 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="734.266µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-89d225211adf3f5bae05 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="767.025µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-5de0046c22bd15665b65 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="649.204µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-553661d66ea675aefccd size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="759.538µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-376b52e8a9c4237182d1 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="736.935µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-1e1f1f58610cdab91264 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="894.11µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-c4d1f9c26843ee870cca size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="705.747µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-c5e4ebaf7c1fa1144ebc size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration=1.119858ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-0265577af72c5e80ed18 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="606.774µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-f0e09d660ee896efd6f4 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="661.074µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-026485eda1bc0ce1b5de size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="641.977µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-5dfa953392f1c49170ae size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="804.935µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-15de761ce22dd3824797 size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="662.275µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-02821a2bdb623d9bed8a size=24 status=302
INFO[2020-01-02T22:05:54+03:00] / content_type=text/html db=0s duration="603.925µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-5b9bbe676ea56c4f28ae size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=2.500551ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-5c14068d44aacee8e9c1 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=3.782355ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-3ea9d787291f025df720 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=5.61055ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-e8259dd20706a96a9852 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration="763.041µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-cb6df5a9b23ea559b6c7 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration="956.053µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-32187acd93bf0221f789 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration="795.573µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-19bc675a09db7ba24f69 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration="976.963µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-22c4d975eabe36cc98fa size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=2.308745ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-97738cf016bab7783c61 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration="724.521µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-1788e684377b84b51a65 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration="747.401µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-f52e4e35feb1d913c4d6 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=3.740987ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-cad827177376b48894f3 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration="866.883µs" human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-fc0afaf9d9859d53796c size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=1.485481ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-66b155aa467eac5a50da size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=1.346937ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-adcd3e17360c8864d942 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=1.088301ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-7dc331801958afcf2aa8 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=2.93361ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-306814463bc36ef38555 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=2.13562ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-34a3725b0d4c9e7462ba size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=2.439783ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-48437aa89b5a9a746982 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=1.282544ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-56ad866d7f32a241d285 size=24 status=302
INFO[2020-01-02T22:05:59+03:00] / content_type=text/html db=0s duration=2.508805ms human_size="24 B" method=GET params="{}" path=/ request_id=bbeef03432005eb084ba-8708a7624ff808d95cd2 size=24 status=302

Remove go-get for Goth

It seems the plugin does:

g.Add(makr.NewCommand(makr.GoGet("github.com/markbates/goth/...")))

But it doesn't use goth, we need to confirm this and remove this go get call.

`buffalo g auth` needs an update

  • form_for -> formFor
  • Replace untagged dependencies with tagged dependencies (e.g. replace github.com/gobuffalo/validate with github.com/gobuffalo/validate/v3, etc.
  • etc.

An update is needed for buffalo g auth to work seamlessly with latest Buffalo. Also, #67

Proposal: Add JWT support to buffalo-auth

Would there be value in integrating JWT support directly into the buffalo-auth plugin, or would that be better suited for a separate plugin to be installed/used when needed? I can understand either case but wanted to propose it here.

My thought is to leave the current behavior of the auth generation as the default, with an additional option to execute it in JWT mode.

As a note, I recently worked on a plugin for JWT auth setup that should (hopefully) be mostly reusable, found here: https://github.com/MotionMobs/buffalo-token-auth

Thanks for thoughts on this!

Error running buffalo-auth migration

Ran:

  1. buffalo g auth
  2. soda migrate up
Error: problem inserting migration version 1544231959969299000: Error 1406: Data too long for column 'version' at row 1

User table is created. Register/Login works.

plugin fails to install

Hi,
I'm trying to install this plugin with the command:
'buffalo plugins install github.com/gobuffalo/buffalo-auth'

But it gives the following error:

github.com/gobuffalo/buffalo/render ../../pkg/mod/github.com/gobuffalo/[email protected]/render/template_helpers.go:21:23: cannot use "github.com/gobuffalo/helpers/tags".JS (type func(string, "github.com/gobuffalo/tags/v3".Options) "html/template".HTML) as type func(string, "github.com/gobuffalo/tags".Options) "html/template".HTML in field value ../../pkg/mod/github.com/gobuffalo/[email protected]/render/template_helpers.go:22:23: cannot use "github.com/gobuffalo/helpers/tags".CSS (type func(string, "github.com/gobuffalo/tags/v3".Options) "html/template".HTML) as type func(string, "github.com/gobuffalo/tags".Options) "html/template".HTML in field value ../../pkg/mod/github.com/gobuffalo/[email protected]/render/template_helpers.go:23:16: cannot use "github.com/gobuffalo/helpers/tags".Img (type func(string, "github.com/gobuffalo/tags/v3".Options) "html/template".HTML) as type func(string, "github.com/gobuffalo/tags".Options) "html/template".HTML in field value

Any thoughts?

output of 'buffalo info':

-> Go: Checking installation ✓ The `go` executable was found on your system at: /usr/local/go/bin/go -> Go: Checking minimum version requirements ✓ Your version of Go, 1.13.7, meets the minimum requirements. -> Go: Checking Package Management ✓ You are using Go Modules (`go`) for package management. -> Go: Checking PATH ✓ Your PATH contains /home/jw/go/bin. -> Node: Checking installation ✓ The `node` executable was found on your system at: /usr/local/bin/node -> Node: Checking minimum version requirements ✓ Your version of Node, v12.16.1, meets the minimum requirements. -> NPM: Checking installation ✓ The `npm` executable was found on your system at: /usr/local/bin/npm -> NPM: Checking minimum version requirements ✓ Your version of NPM, 6.13.4, meets the minimum requirements. -> Yarn: Checking installation ✓ The `yarnpkg` executable was found on your system at: /usr/bin/yarnpkg -> Yarn: Checking minimum version requirements ✓ Your version of Yarn, 1.22.0, meets the minimum requirements. -> PostgreSQL: Checking installation ✘ The `postgres` executable could not be found on your system. For help setting up your Postgres environment please follow the instructions for you platform at: https://www.postgresql.org/download/ -> MySQL: Checking installation ✓ The `mysql` executable was found on your system at: /usr/bin/mysql -> MySQL: Checking minimum version requirements ✓ Your version of MySQL, 15.1, meets the minimum requirements. -> SQLite3: Checking installation ✘ The `sqlite3` executable could not be found on your system. For help setting up your SQLite3 environment please follow the instructions for you platform at: https://www.sqlite.org/download.html -> Cockroach: Checking installation ✘ The `cockroach` executable could not be found on your system. For help setting up your Cockroach environment please follow the instructions for you platform at: https://www.cockroachlabs.com/docs/stable/ -> Buffalo (CLI): Checking installation ✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo -> Buffalo (CLI): Checking minimum version requirements ✓ Your version of Buffalo (CLI), v0.15.5, meets the minimum requirements. -> Buffalo: Application Details Pwd /home/jw/go/src/fkc Root /home/jw/go/src/fkc GoPath /home/jw/go PackagePkg fkc ActionsPkg fkc/actions ModelsPkg fkc/models GriftsPkg fkc/grifts WithModules true Name fkc Bin bin/fkc VCS git WithPop true WithSQLite false WithDep false WithWebpack true WithNodeJs true WithYarn true WithDocker true WithGrifts true AsWeb true AsAPI false InApp true PackageJSON {map[build:webpack -p --progress dev:webpack --watch]} -> Buffalo: config/buffalo-app.toml name = "fkc" bin = "bin/fkc" vcs = "git" with_pop = true with_sqlite = false with_dep = false with_webpack = true with_nodejs = true with_yarn = true with_docker = true with_grifts = true as_web = true as_api = false -> Buffalo: config/buffalo-plugins.toml [[plugin]] binary = "buffalo-pop" go_get = "github.com/gobuffalo/buffalo-pop" -> Buffalo: go.mod module fkc go 1.14 require ( github.com/gobuffalo/attrs v1.0.0 // indirect github.com/gobuffalo/buffalo v0.14.11 github.com/gobuffalo/buffalo-auth v1.3.0 // indirect github.com/gobuffalo/buffalo-pop v1.23.1 github.com/gobuffalo/envy v1.9.0 github.com/gobuffalo/fizz v1.9.8 // indirect github.com/gobuffalo/flect v0.2.1 // indirect github.com/gobuffalo/genny v0.6.0 // indirect github.com/gobuffalo/helpers v0.6.1 // indirect github.com/gobuffalo/meta v0.3.0 // indirect github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517 github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130 github.com/gobuffalo/mw-i18n v0.0.0-20190129204410-552713a3ebb4 github.com/gobuffalo/mw-paramlogger v0.0.0-20190129202837-395da1998525 github.com/gobuffalo/packd v1.0.0 // indirect github.com/gobuffalo/packr/v2 v2.7.1 github.com/gobuffalo/pop v4.13.1+incompatible github.com/gobuffalo/suite v2.8.2+incompatible github.com/gobuffalo/validate v2.0.4+incompatible // indirect github.com/gobuffalo/validate/v3 v3.1.0 // indirect github.com/markbates/grift v1.1.0 github.com/spf13/cobra v0.0.6 // indirect github.com/unrolled/secure v0.0.0-20190103195806-76e6d4e9b90c golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d // indirect golang.org/x/mod v0.2.0 // indirect golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect golang.org/x/tools v0.0.0-20200226224502-204d844ad48d // indirect golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect )

buffalo-auth generator doesn't work

Description

buffalo-auth generator doesn't work.

Steps to Reproduce the Problem

Following the steps in the documentation.

  1. Create a new project
  2. Install the plugin
  3. Run auth generator

Expected Behavior

The generator should do what it should do and end successfully.

Actual Behavior

The generator fails:

$ buffalo generate auth
Error: templates/auth/new.plush.html: line 22: "user": unknown identifier
Usage:
  buffalo generate auth [flags]

Flags:
  -h, --help   help for auth

ERRO[0003] Error: exit status 1

Info

-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/go/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.13, meets the minimum requirements.

-> Go: Checking GOPATH
✓ You appear to be operating inside of your GOPATH.

-> Go: Checking Package Management
⚠ You do not appear to be using a package management system.

It is strongly suggested that you use one of the following package management systems:

* Go Modules (Recommended) - https://gobuffalo.io/en/docs/gomods
* Dep - https://github.com/golang/dep

For help setting up your Go environment please follow the instructions for you platform at:

https://www.gopherguides.com/courses/preparing-your-environment-for-go-development

-> Go: Checking PATH
✓ Your PATH contains /Users/dschulz/Golang/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /opt/local/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v12.12.0, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /opt/local/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.11.3, meets the minimum requirements.

-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /Users/dschulz/.yarn/bin/yarnpkg

-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 1.19.1, meets the minimum requirements.

-> PostgreSQL: Checking installation
✓ The `postgres` executable was found on your system at: /Applications/Postgres.app/Contents/Versions/latest/bin/postgres

-> PostgreSQL: Checking minimum version requirements
✓ Your version of PostgreSQL, 12.0.0, meets the minimum requirements.

-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:

https://www.mysql.com/downloads/

-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /opt/local/bin/sqlite3

-> SQLite3: Checking minimum version requirements
✘ Invalid Semantic Version

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo

-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.14.11, meets the minimum requirements.

-> Buffalo: Application Details
Pwd         /Users/dschulz/Golang/src/crud33
Root        /Users/dschulz/Golang/src/crud33
GoPath      /Users/dschulz/Golang
PackagePkg  crud33
ActionsPkg  crud33/actions
ModelsPkg   crud33/models
GriftsPkg   crud33/grifts
WithModules false
Name        crud33
Bin         bin/crud33
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[build:webpack -p --progress dev:webpack --watch]}

-> Buffalo: config/buffalo-app.toml
name = "crud33"
bin = "bin/crud33"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-auth"
  go_get = "github.com/gobuffalo/buffalo-auth"

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop"

Migrations path is incorrect

Running buffalo g auth puts the migrations to migrations/1540132083054300100_migrations/create_users.down.fizz and migrations/1540132083089396100_migrations/create_users.up.fizz.

They should instead go to migrations/1540132083054300100_create_users.down.fizz (and up respectively) and use the same timestamp.

Working on a fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.