aboutsummaryrefslogtreecommitdiff
path: root/src/actions/sign_ups/create.cr
blob: a291ca68004cb3ecd04a6390faa35f2501f87197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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