td 0.10.41 → 0.10.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +5 -0
- data/lib/td/command/list.rb +1 -0
- data/lib/td/command/user.rb +50 -3
- data/lib/td/version.rb +1 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/lib/td/command/list.rb
CHANGED
@@ -277,6 +277,7 @@ module List
|
|
277
277
|
add_list 'user:create', %w[name], 'Create an user'
|
278
278
|
add_list 'user:delete', %w[name], 'Delete an user'
|
279
279
|
add_list 'user:apikey:list', %w[name], 'Show API keys'
|
280
|
+
add_list 'user:password:change', %w[name], 'Change password'
|
280
281
|
|
281
282
|
add_list 'role:list', %w[], 'Show list of roles'
|
282
283
|
add_list 'role:show', %w[name], 'Show a role'
|
data/lib/td/command/user.rb
CHANGED
@@ -178,9 +178,56 @@ module Command
|
|
178
178
|
puts cmd_render_table(rows, :fields => [:Key])
|
179
179
|
end
|
180
180
|
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
def user_password_change(op)
|
182
|
+
name = op.cmd_parse
|
183
|
+
|
184
|
+
password = nil
|
185
|
+
|
186
|
+
3.times do
|
187
|
+
begin
|
188
|
+
system "stty -echo" # TODO termios
|
189
|
+
print "Password (typing will be hidden): "
|
190
|
+
password = STDIN.gets || ""
|
191
|
+
password = password[0..-2] # strip \n
|
192
|
+
rescue Interrupt
|
193
|
+
$stderr.print "\ncanceled."
|
194
|
+
exit 1
|
195
|
+
ensure
|
196
|
+
system "stty echo" # TODO termios
|
197
|
+
print "\n"
|
198
|
+
end
|
199
|
+
|
200
|
+
if password.empty?
|
201
|
+
$stderr.puts "canceled."
|
202
|
+
exit 0
|
203
|
+
end
|
204
|
+
|
205
|
+
begin
|
206
|
+
system "stty -echo" # TODO termios
|
207
|
+
print "Retype password: "
|
208
|
+
password2 = STDIN.gets || ""
|
209
|
+
password2 = password2[0..-2] # strip \n
|
210
|
+
rescue Interrupt
|
211
|
+
$stderr.print "\ncanceled."
|
212
|
+
exit 1
|
213
|
+
ensure
|
214
|
+
system "stty echo" # TODO termios
|
215
|
+
print "\n"
|
216
|
+
end
|
217
|
+
|
218
|
+
if password == password2
|
219
|
+
break
|
220
|
+
end
|
221
|
+
|
222
|
+
puts "Doesn't match."
|
223
|
+
end
|
224
|
+
|
225
|
+
client = get_client(:ssl => true)
|
226
|
+
|
227
|
+
client.change_password(name, password)
|
228
|
+
|
229
|
+
$stderr.puts "Password of user '#{name}' changed."
|
230
|
+
end
|
184
231
|
|
185
232
|
end
|
186
233
|
end
|
data/lib/td/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.42
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|