plesk_kit 2.1.4 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGJmZTQwZjFjMzZiZTQ2MjA4OTc1MWU1YWNlYjc5NTlmMTNlMWZhZA==
4
+ M2IxYzFhNWI5NTUzZmFlOGY1MGU5NjM4MWNjZDZjNjllYjQzYjZkOA==
5
5
  data.tar.gz: !binary |-
6
- ZjBlYTRkZmU4YmFkNzU4NThkMDZiZWUzNTgzMzNmZWJmNjZlYmQxYw==
6
+ Y2U5MzQ5YzY4ODU2MjA0YWFhNmYxZTExZDA0MDUwNGQ1ZjQ4NzhlZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2VlYTMyODYyMWRjZDAyYzk0Y2M4ZmYyYmVkNzRjZTUwMDA0MjIwZDhiZTQz
10
- ZjQ2NDRjZTdlYzdmMmE2Yjc3NGU2NzI1ODE5NmEwZDZiZGMwOTFmNTU4YjJl
11
- ODE5MTQ2ZjNjYjIyOWU3MTgwNDJiNjU4OWYwZmMxMTIwYzNlMzI=
9
+ YzQzNDQ0NTEwMmViOTA0Yzc4ODQ3OTQyNTc2MmY5YjZlZTk5ZGM3ZDEzMjkz
10
+ YjgwOTAzNWE4MDRkNzY1YWVmNGQ5OGY4ZjU3YWQ3MTgwMmI4MDU3MjI0ODc4
11
+ ZmIyZTRhMzRmMmMxMDUxYWNiYWY4ZjkxYzY2MjA3MGE5ZmJjNzU=
12
12
  data.tar.gz: !binary |-
13
- ZDAxZTYxZTk0NGQzOGJiY2UzNTRkZTZmMzQ2NDQyNDBmMWJhMzEwYzRmNmY1
14
- NDA4MmE4NDI2NmVlOGVjYmY3MGU4NGIwMjk0N2Q0MWNkNDIyZmQ1ZDIwNDhl
15
- NjBlMTQ3NGRjYWJkYTg2ZDVkNTEzMmE3NGJjNzZjNjdjYzQ4ODA=
13
+ NThkYmI3NmY3MTAwMmRjYzA3M2JkZjg4Mjg3Yzg1MWJkYzg0N2U4YTc4M2Fi
14
+ MTYzYjZiNzU5NmM4OTc5ZGIzZmNmMjNlZDgyMWY2MWY0MDZiNzZmY2M3NGI0
15
+ NmExMzdiNDRkMjVmY2ZiY2RiYTNhZDJhMWNmYWZlNzAxM2ZjY2E=
@@ -17,6 +17,13 @@ module PleskKit
17
17
  account.analyse response[0], server.id
18
18
  end
19
19
 
20
+ def self.pack_and_reset_password account, new_password
21
+ server = account.server
22
+ packet = account.password_reset_pack shell, new_password
23
+ response = transportation_for packet, server
24
+ account.analyse_password_reset response[0]
25
+ end
26
+
20
27
  def self.pack_and_play_with_subscription subscription, customer_account
21
28
  server = customer_account.server
22
29
  packet = subscription.pack_this shell, customer_account
@@ -11,6 +11,11 @@ module PleskKit
11
11
  true
12
12
  end
13
13
 
14
+ def reset_password(new_password)
15
+ PleskKit::Communicator.pack_and_reset_password self, new_password
16
+ true
17
+ end
18
+
14
19
  # # #
15
20
  # Methods for sending brand new customer account to Plesk
16
21
  # # #
@@ -42,6 +47,25 @@ module PleskKit
42
47
  return xml.target!
43
48
  end
44
49
 
50
+ def password_reset_pack shell, new_password
51
+ xml = shell
52
+ xml.instruct!
53
+ xml.packet(:version => '1.6.3.5') {
54
+ xml.customer {
55
+ xml.set{
56
+ xml.filter{
57
+
58
+ }
59
+ xml.values{
60
+ xml.gen_info{
61
+ xml.passwd(new_password)
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ end
68
+
45
69
  def analyse response_string, server_id
46
70
  xml = REXML::Document.new(response_string)
47
71
  status = xml.root.elements['//status'].text if xml.root.elements['//status'].present?
@@ -57,6 +81,18 @@ module PleskKit
57
81
  return self # TODO save plesk_id
58
82
  end
59
83
 
84
+ def analyse_password_reset response_string
85
+ xml = REXML::Document.new(response_string)
86
+ status = xml.root.elements['//status'].text if xml.root.elements['//status'].present?
87
+ if status == "error"
88
+ code = xml.root.elements['//errcode'].text
89
+ message = xml.root.elements['//errtext'].text
90
+ raise "#{code}: #{message}"
91
+ else
92
+ true
93
+ end
94
+ end
95
+
60
96
  private
61
97
  def uniqueness_of_login_across_accounts
62
98
  if PleskKit::CustomerAccount.find_by_login(self.login).present?
@@ -1,3 +1,3 @@
1
1
  module PleskKit
2
- VERSION = "2.1.4"
2
+ VERSION = "2.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plesk_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dionne Saunders
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-29 00:00:00.000000000 Z
11
+ date: 2013-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails