Class: ADAM6050::Handler::Login
- Inherits:
-
Object
- Object
- ADAM6050::Handler::Login
- Includes:
- ADAM6050::Handler
- Defined in:
- lib/adam6050/handler/login.rb
Overview
Allows senders to login.
I have so far not been able to find any documentation around this feature. It is therefore almost certain that the response in case of an incorrect password is wrong.
Constant Summary collapse
- MESSAGE_PREAMBLE =
'$01PW'
Instance Method Summary collapse
- #handle(msg, state, session, sender) ⇒ Integer, String
-
#initialize(password = nil) ⇒ Login
constructor
A new instance of Login.
-
#validate? ⇒ false
The login handler does not require the sender to be validated.
Methods included from ADAM6050::Handler
Constructor Details
#initialize(password = nil) ⇒ Login
18 19 20 21 |
# File 'lib/adam6050/handler/login.rb', line 18 def initialize(password = nil) @password = Password.new password freeze end |
Instance Method Details
#handle(msg, state, session, sender) ⇒ Integer, String
31 32 33 34 35 36 37 |
# File 'lib/adam6050/handler/login.rb', line 31 def handle(msg, state, session, sender) return state, '?' unless @password == msg[6..-1].chomp! session.register sender [state, '>01'] end |
#validate? ⇒ false
41 42 43 |
# File 'lib/adam6050/handler/login.rb', line 41 def validate? false end |