Module: Uffizzi::LoginHelper
- Defined in:
- lib/uffizzi/helpers/login_helper.rb
Class Method Summary collapse
- .prepare_request_params(username, password) ⇒ Object
- .set_password ⇒ Object
- .set_server(options) ⇒ Object
- .set_username(options) ⇒ Object
Class Method Details
.prepare_request_params(username, password) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/uffizzi/helpers/login_helper.rb', line 8 def prepare_request_params(username, password) { user: { email: username, password: password, }, } end |
.set_password ⇒ Object
29 30 31 |
# File 'lib/uffizzi/helpers/login_helper.rb', line 29 def set_password ENV['UFFIZZI_PASSWORD'] || Uffizzi.ui.ask('Password:', echo: false) end |
.set_server(options) ⇒ Object
17 18 19 20 21 |
# File 'lib/uffizzi/helpers/login_helper.rb', line 17 def set_server() config_server = ConfigFile.exists? ? Uffizzi::ConfigHelper.read_option_from_config(:server) : nil server_address = [:server] || config_server || Uffizzi.configuration.default_server.to_s server_address.start_with?('http:', 'https:') ? server_address : "https://#{server_address}" end |
.set_username(options) ⇒ Object
23 24 25 26 27 |
# File 'lib/uffizzi/helpers/login_helper.rb', line 23 def set_username() config_username = ConfigFile.exists? ? Uffizzi::ConfigHelper.read_option_from_config(:username) : nil = [:email].present? ? [:email] : nil || config_username || Uffizzi.ui.ask('Username:') end |