Updated Change Password
parent
e08c6442fb
commit
8c7d4778a1
|
@ -1,3 +1,6 @@
|
||||||
|
Version 0.5 Changelogs:
|
||||||
|
- Replaced Change Password from list of users to input the username and also a field to input the password
|
||||||
|
|
||||||
Version 0.4 Changelogs:
|
Version 0.4 Changelogs:
|
||||||
- Replaced auto-generated usernames with user-defined usernames
|
- Replaced auto-generated usernames with user-defined usernames
|
||||||
- Added username validation (3-32 characters, alphanumeric + underscore only)
|
- Added username validation (3-32 characters, alphanumeric + underscore only)
|
||||||
|
|
18
manifest.jps
18
manifest.jps
|
@ -1,4 +1,4 @@
|
||||||
version: 0.4
|
version: 0.5
|
||||||
id: addsftp
|
id: addsftp
|
||||||
type: update
|
type: update
|
||||||
description: An addon to add new SFTP users. It can also manage created user accounts. If SSH is enabled, WP-CLI will attempt to be installed if it is not yet installed.
|
description: An addon to add new SFTP users. It can also manage created user accounts. If SSH is enabled, WP-CLI will attempt to be installed if it is not yet installed.
|
||||||
|
@ -41,6 +41,12 @@ settings:
|
||||||
description: "Input the username you want to manage."
|
description: "Input the username you want to manage."
|
||||||
required: true
|
required: true
|
||||||
values: []
|
values: []
|
||||||
|
- type: string
|
||||||
|
name: custom_password
|
||||||
|
caption: New Password
|
||||||
|
description: "Enter a new password or leave empty to generate one automatically"
|
||||||
|
required: false
|
||||||
|
inputType: password
|
||||||
|
|
||||||
onBeforeInit: |
|
onBeforeInit: |
|
||||||
let cmd = 'ls -ld /home/sftpusers/* | awk \'{printf "%s,%s %s %s\\n", substr($9, 17), $6, $7, $8}\''
|
let cmd = 'ls -ld /home/sftpusers/* | awk \'{printf "%s,%s %s %s\\n", substr($9, 17), $6, $7, $8}\''
|
||||||
|
@ -127,10 +133,16 @@ actions:
|
||||||
type: info
|
type: info
|
||||||
message: "Connection Details\n\nSFTP Host: ${globals.sftpHost}\n\nPort: ${globals.sftpPort}\n\nLogin Credentials\n\nUsername: ${globals.username}\n\nPassword: ${globals.password}"
|
message: "Connection Details\n\nSFTP Host: ${globals.sftpHost}\n\nPort: ${globals.sftpPort}\n\nLogin Credentials\n\nUsername: ${globals.username}\n\nPassword: ${globals.password}"
|
||||||
change_password:
|
change_password:
|
||||||
|
- if (!${settings.custom_password:false}):
|
||||||
|
setGlobals:
|
||||||
|
custom_password: ${fn.password(min)}
|
||||||
|
else:
|
||||||
|
setGlobals:
|
||||||
|
custom_password: ${settings.custom_password}
|
||||||
- cmd[cp]:
|
- cmd[cp]:
|
||||||
user: root
|
user: root
|
||||||
commands:
|
commands:
|
||||||
- echo "${settings.manage_username}:${globals.password}" | chpasswd
|
- echo "${settings.manage_username}:${globals.custom_password}" | chpasswd
|
||||||
- echo "Password changed for ${settings.manage_username}" >> /home/jelastic/add-sftp-user-addon/logs/script_output.log
|
- echo "Password changed for ${settings.manage_username}" >> /home/jelastic/add-sftp-user-addon/logs/script_output.log
|
||||||
- if ("${response.exitStatus}" != "0"):
|
- if ("${response.exitStatus}" != "0"):
|
||||||
return: passwordChangeError
|
return: passwordChangeError
|
||||||
|
@ -167,7 +179,7 @@ responses:
|
||||||
message: "Failed to change password for ${settings.manage_username}. Check logs for details."
|
message: "Failed to change password for ${settings.manage_username}. Check logs for details."
|
||||||
passwordChangeSuccess:
|
passwordChangeSuccess:
|
||||||
type: success
|
type: success
|
||||||
message: "Password changed successfully for ${settings.manage_username}.\n\n New password: ${globals.password}"
|
message: "Password changed successfully for ${settings.manage_username}.\n\n New password: ${globals.custom_password}"
|
||||||
deleteUserError:
|
deleteUserError:
|
||||||
type: error
|
type: error
|
||||||
message: "Failed to delete user ${settings.manage_username}. Check logs for details."
|
message: "Failed to delete user ${settings.manage_username}. Check logs for details."
|
||||||
|
|
Loading…
Reference in New Issue