gobuffalo / authrecipe Goto Github PK
View Code? Open in Web Editor NEWA recipe for using Buffalo & Password Authentication
A recipe for using Buffalo & Password Authentication
Hello,
I'm trying to follow your guide for authentication and I have a question regarding using the Password
and PasswordConfirmation
fields of the User
model.
What's the proper way to model these two fields? If I use them with json: "-"
as the recipe states, I'm not able to bind them to the user model in the creation action (they're always empty), and thus validations can't be performed. Is there anything else I should take into account here?
Thanks!
Hi, thanks for buffalo
! just trying to get started with it to see if it will fit my needs on a job tracking app I need to build. And auth was the first step.
Had a couple of issues getting started with this repo, after cloning;
go get gopkg.in/yaml.v1
go get
buffalo db migrate
To get the users table set up
main.go
to launch the app with:log.Fatal(app.Start("0.0.0.0:3000"))
But not sure if that was the correct thing to do
Where is session reflected
I am trying to walk through verbatim the instructions in the README file. I am on macOS with a new install of postgres that is started. Buffalo has no problem connecting, creating the db, and migrating. I install npm with Homebrew and run npm install
. Finally, I run buffalo dev
and after a large log dump, it serves the app but without any assets.
I'm running go version go1.10 darwin/amd64
. Any help would be greatly appreciated. I am eager to start using Buffalo and an authentication solution is the first step for me.
I wanted to try the example at https://github.com/gobuffalo/authrecipe but with a sqlite3 and I could not get it to work.
$ brew install gobuffalo/tap/buffalo
$ git clone https://github.com/gobuffalo/authrecipe && cd authrecipe
$ mv database.yml database.yml.orig
$ buffalo pop g config -t sqlite3
$ buffalo db create -a
v4.12.2
[POP] 2020/01/27 21:26:46 warn - unable to load connection development: unsupported dialect 'sqlite3'
[POP] 2020/01/27 21:26:46 warn - unable to load connection test: unsupported dialect 'sqlite3'
[POP] 2020/01/27 21:26:46 warn - unable to load connection production: unsupported dialect 'sqlite3'
$ buffalo build --static -o bin/app
ERRO[2020-01-27T21:28:22+01:00]
Usage:
buffalo build [flags]
Aliases:
build, b, bill, install
Flags:
--clean-assets will delete public/assets before calling webpack
--dry-run runs the build 'dry'
--environment string set the environment for the binary (default "development")
-e, --extract-assets extract the assets and put them in a distinct archive
-h, --help help for build
--ldflags string set any ldflags to be passed to the go build
--mod string -mod flag for go build
-o, --output string set the name of the binary
-k, --skip-assets skip running webpack and building assets
--skip-build-deps skip building dependencies
--skip-template-validation skip validating templates
-s, --static build a static binary using --ldflags '-linkmode external -extldflags "-static"'
-t, --tags string compile with specific build tags
-v, --verbose print debugging information
ERRO[0002] Error: exec: "yarnpkg": executable file not found in $PATH
Then I tried docker
% docker build .
...
Step 8/16 : RUN go get $(go list ./... | grep -v /vendor/)
---> Running in d09e30c19356
../buffalo/render/helpers.go:10:2: cannot find package "github.com/gobuffalo/tags" in any of:
/usr/local/go/src/github.com/gobuffalo/tags (from $GOROOT)
/go/src/github.com/gobuffalo/tags (from $GOPATH)
models/user.go:9:2: cannot find package "github.com/gobuffalo/validate" in any of:
/usr/local/go/src/github.com/gobuffalo/validate (from $GOROOT)
/go/src/github.com/gobuffalo/validate (from $GOPATH)
The command '/bin/sh -c go get $(go list ./... | grep -v /vendor/)' returned a non-zero code: 1
The following should work
$ buffalo db create -a
$ buffalo db migrate
$ npm install
$ buffalo dev
Even with sqlite3.
I then tried brew install yarn
. That got me a little further but now webpack
is missing. Well, npm i
failed - so that is kind of expected I guess. Nevertheless - it seems like some things are missing from the installation instructions.
The dialect sqlite
seems unknow, some reference to a missing yarnpkg
and npm install
is failing on the native dependencies. (I bet a node version thing).
Here is the output of buffalo info
:
$ buffalo info
-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/bin/go
-> Go: Checking minimum version requirements
✓ Your version of Go, 1.13.6, meets the minimum requirements.
-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.
-> Go: Checking PATH
✓ Your PATH contains /Users/tcurdt/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, v13.7.0, 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.6, meets the minimum requirements.
-> Yarn: Checking installation
✘ The `yarnpkg` executable could not be found on your system.
For help setting up your Yarn environment please follow the instructions for you platform at:
https://yarnpkg.com/en/docs/install
-> 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: /usr/bin/sqlite3
-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.28.0, 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: /usr/local/bin/buffalo
-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.15.4, meets the minimum requirements.
-> Buffalo: Application Details
Pwd /Users/tcurdt/Downloads/authrecipe
Root /Users/tcurdt/Downloads/authrecipe
GoPath /Users/tcurdt/go
PackagePkg github.com/gobuffalo/authrecipe
ActionsPkg github.com/gobuffalo/authrecipe/actions
ModelsPkg github.com/gobuffalo/authrecipe/models
GriftsPkg github.com/gobuffalo/authrecipe/grifts
WithModules true
Name authrecipe
Bin bin/authrecipe
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 = "authrecipe"
bin = "bin/authrecipe"
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 github.com/gobuffalo/authrecipe
go 1.12
require (
github.com/gobuffalo/buffalo v0.14.8
github.com/gobuffalo/buffalo-pop v1.16.0
github.com/gobuffalo/envy v1.7.0
github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517
github.com/gobuffalo/mw-forcessl v0.0.0-20190224202501-6d1ef7ffb276
github.com/gobuffalo/mw-i18n v0.0.0-20190224203426-337de00e4c33
github.com/gobuffalo/mw-paramlogger v0.0.0-20190224201358-0d45762ab655
github.com/gobuffalo/packr/v2 v2.5.2
github.com/gobuffalo/pop v4.11.2+incompatible
github.com/gobuffalo/suite v2.8.1+incompatible
github.com/gobuffalo/validate v2.0.3+incompatible
github.com/gofrs/uuid v3.2.0+incompatible
github.com/markbates/grift v1.1.0
github.com/pkg/errors v0.8.1
github.com/unrolled/secure v1.0.1
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
)
Wrong package sorry.
(gobuffalo/gothrecipe#1)
Closing
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.