asciinema.org/app/controllers/logins_controller.rb
2014-10-17 20:24:22 +02:00

28 lines
472 B
Ruby

class LoginsController < ApplicationController
def new; end
def create
email = params[:email].strip
if login_service.login(email)
redirect_to sent_login_path, flash: { email_recipient: email }
else
@invalid_email = true
render :new
end
end
def sent
@email_recipient = flash[:email_recipient]
redirect_to new_login_path unless @email_recipient
end
private
def login_service
EmailLoginService.new
end
end