diff options
Diffstat (limited to 'src/actions/sign_ups')
-rw-r--r-- | src/actions/sign_ups/create.cr | 16 | ||||
-rw-r--r-- | src/actions/sign_ups/new.cr | 7 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/actions/sign_ups/create.cr b/src/actions/sign_ups/create.cr new file mode 100644 index 0000000..a291ca6 --- /dev/null +++ b/src/actions/sign_ups/create.cr @@ -0,0 +1,16 @@ +class SignUps::Create < BrowserAction + include Auth::RedirectSignedInUsers + + post "/sign_up" do + SignUpUser.create(params) do |operation, user| + if user + flash.info = "Thanks for signing up" + sign_in(user) + redirect to: Home::Index + else + flash.info = "Couldn't sign you up" + html NewPage, operation: operation + end + end + end +end diff --git a/src/actions/sign_ups/new.cr b/src/actions/sign_ups/new.cr new file mode 100644 index 0000000..2299df6 --- /dev/null +++ b/src/actions/sign_ups/new.cr @@ -0,0 +1,7 @@ +class SignUps::New < BrowserAction + include Auth::RedirectSignedInUsers + + get "/sign_up" do + html NewPage, operation: SignUpUser.new + end +end |