Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Commit

Permalink
Merge pull request #56 from stufi/issue/42-no-password-supplied
Browse files Browse the repository at this point in the history
This should address the issues described in [#42]
  • Loading branch information
KrauseFx committed Jan 1, 2016
2 parents 7668f4c + 71b1cf7 commit a1f9508
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/match/change_password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Match
class ChangePassword
def self.update(params: nil, from: nil, to: nil)
to ||= ChangePassword.ask_password("New passphrase for Git Repo: ")
from ||= ChangePassword.ask_password("Old passphrase for Git Repo: ")
GitHelper.clear_changes
workspace = GitHelper.clone(params[:git_url], params[:shallow_clone], manual_password: from)
Encrypt.new.clear_password(params[:git_url])
Expand All @@ -12,8 +13,8 @@ def self.update(params: nil, from: nil, to: nil)
end

def self.ask_password(msg = "Passphrase for Git Repo: ")
password = ""
while password.to_s.length == 0
password = nil
while password == nil
password = ask(msg.yellow) { |q| q.echo = "*" }
password2 = ask("Type passphrase again: ".yellow) { |q| q.echo = "*" }
if password != password2
Expand Down
2 changes: 1 addition & 1 deletion lib/match/encrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def iterate(source_path)
end

def crypt(path: nil, password: nil, encrypt: true)
if password.to_s.strip.length == 0
if password.to_s.strip.length == 0 && encrypt
UI.user_error!("No password supplied")
end

Expand Down

0 comments on commit a1f9508

Please sign in to comment.