lib/generators/terminalwire/install/templates/application_terminal.rb.tt in terminalwire-0.1.10 vs lib/generators/terminalwire/install/templates/application_terminal.rb.tt in terminalwire-0.1.11
- old
+ new
@@ -10,26 +10,26 @@
end
desc "login", "Login to your account"
def login
print "Email: "
- email = gets
+ email = gets.chomp
print "Password: "
password = getpass
if self.current_user = User.authenticate(email, password)
- puts "Successfully logged in as #{user.email}."
+ puts "Successfully logged in as #{current_user.email}."
else
puts "Could not find a user with that email and password."
end
end
desc "whoami", "Displays current user information."
def whoami
if self.current_user
- puts "Logged in as #{user.email}."
+ puts "Logged in as #{current_user.email}."
else
puts "Not logged in. Run `#{self.class.basename} login` to login."
end
end
@@ -47,8 +47,8 @@
# and encrypted client-side cookies.
session["user_id"] = user.id
end
def current_user
- @current_user ||= User.find(session.fetch("user_id"))
+ @current_user ||= User.find(session["user_id"])
end
end