From 45ab02b8e3b03c9f2da704786190b420ef726cec Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 27 Jun 2013 17:58:54 +0200 Subject: Save passwords set via 'set' as hash, if asked to. Trocla doesn't save the hashed password in the data file, even if the format passed to 'set' is not 'plain': $ echo foobar | trocla set testuser sha512crypt -p $ grep -A1 testuser trocla_data.yaml testuser: sha512crypt: foobar --- bin/trocla | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/trocla b/bin/trocla index 39b9e76..a4f51cc 100755 --- a/bin/trocla +++ b/bin/trocla @@ -64,10 +64,11 @@ def set(options) else password = options.delete(:password) || STDIN.read.chomp end + format = options.delete(:trocla_format) Trocla.new(options.delete(:config_file)).set_password( options.delete(:trocla_key), - options.delete(:trocla_format), - password + format, + Trocla::Formats[format].format(password, options.delete(:other_options).shift.to_s) ) "" end -- cgit v1.2.3