Class: SafeDb::Login
- Inherits:
-
Authenticate
- Object
- Controller
- Authenticate
- SafeDb::Login
- Defined in:
- lib/controller/access/login.rb
Overview
-
an environment variable
-
the system clipboard (cleared after reading)
-
a file whose path is a command parameter
-
a file in a pre-agreed location
-
a file in the present directory (with a pre-agreed name)
-
a URL from a parameter or pre-agreed
-
the shell’s secure password reader
Instance Attribute Summary collapse
-
#clip ⇒ Object
writeonly
If the clip switch is present it signifies that the password should be read in from the clipboard.
-
#login_book_id ⇒ Object
writeonly
Either the @book_name or the @login_book_id may be provided.
-
#suppress_output ⇒ Object
writeonly
The view of chapter and verse names within the book is not printed out after a successful login if this suppress_output flag is set to true.
Attributes inherited from Authenticate
Instance Method Summary collapse
Methods inherited from Controller
#check_post_conditions, #check_pre_conditions, #flow, #initialize, #open_remote_backend_location, #post_validation, #pre_validation, #read_verse, #set_verse, #update_verse
Constructor Details
This class inherits a constructor from SafeDb::Controller
Instance Attribute Details
#clip=(value) ⇒ Object (writeonly)
If the clip switch is present it signifies that the password should be read in from the clipboard. Any text selection puts text into the the clipboard - no need specifically to use Ctrl-c (copy).
31 32 33 |
# File 'lib/controller/access/login.rb', line 31 def clip=(value) @clip = value end |
#login_book_id=(value) ⇒ Object (writeonly)
Either the @book_name or the @login_book_id may be provided. The
35 36 37 |
# File 'lib/controller/access/login.rb', line 35 def login_book_id=(value) @login_book_id = value end |
#suppress_output=(value) ⇒ Object (writeonly)
The view of chapter and verse names within the book is not printed out after a successful login if this suppress_output flag is set to true.
39 40 41 |
# File 'lib/controller/access/login.rb', line 39 def suppress_output=(value) @suppress_output = value end |
Instance Method Details
#execute ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/controller/access/login.rb', line 41 def execute @book_id = @login_book_id if @login_book_id @book_id = Identifier.derive_ergonomic_identifier( @book_name, Indices::SAFE_BOOK_ID_LENGTH ) unless @login_book_id @book_reference = @login_book_id if @login_book_id @book_reference = @book_name unless @login_book_id unless ( is_book_initialized?() ) print_not_initialized return end if( StateInspect.is_logged_in?( @book_id ) ) EvolveState.use_book( @book_id ) View.new().flow() unless @suppress_output return end book_password = Clipboard.read_password() if @clip book_password = KeyPass.password_from_shell( false ) if( @password.nil?() && !@clip ) book_password = @password unless @password.nil?() book_keys = DataMap.new( Indices::MASTER_INDICES_FILEPATH ) book_keys.use( @book_id ) is_login_successful = EvolveState.login( book_keys, book_password ) print_login_failure() unless is_login_successful return unless is_login_successful View.new().flow() unless @suppress_output end |