-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verified Foundry v12 compatibility and changed token tool visibility default to false.
- Loading branch information
1 parent
395e5b8
commit 5b486a0
Showing
4 changed files
with
138 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,31 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [1.1.0] - 2023-06-24 | ||
|
||
### Added | ||
|
||
- Menu option to change password in user list | ||
- Settings to control visibility of token controls and user list menu items | ||
- Both default to true | ||
- Verified for Foundry VTT 11 | ||
|
||
## [1.0.0] - 2022-12-29 | ||
|
||
### Added | ||
|
||
- First release | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [2.0.0] - 2024-06-13 | ||
|
||
### Added | ||
|
||
- Verified for Foundry VTT 12 | ||
|
||
### Changed | ||
|
||
- Changed token controls default visibility to false | ||
|
||
## [1.1.0] - 2023-06-24 | ||
|
||
### Added | ||
|
||
- Menu option to change password in user list | ||
- Settings to control visibility of token controls and user list menu items | ||
- Both default to true | ||
- Verified for Foundry VTT 11 | ||
|
||
## [1.0.0] - 2022-12-29 | ||
|
||
### Added | ||
|
||
- First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
{ | ||
"id": "update-your-password", | ||
"title": "Update Your Password", | ||
"description": "Allows users to update their own password", | ||
"authors": [ | ||
{ | ||
"name": "Richard Robertson", | ||
"url": "https://github.com/RichardRobertson" | ||
} | ||
], | ||
"version": "", | ||
"compatibility": { | ||
"minimum": 10, | ||
"verified": 11 | ||
}, | ||
"esmodules": [ | ||
"scripts/index.mjs" | ||
], | ||
"languages": [ | ||
{ | ||
"lang": "en", | ||
"name": "English", | ||
"path": "lang/en.json" | ||
} | ||
], | ||
"url": "https://github.com/RichardRobertson/update-your-password", | ||
"manifest": "https://github.com/RichardRobertson/update-your-password/releases/latest/download/module.json", | ||
"download": "https://github.com/RichardRobertson/update-your-password/releases/download/v__VERSION__/update-your-password-v__VERSION__.zip", | ||
"license": "LICENSE.md", | ||
"readme": "README.md", | ||
"bugs": "https://github.com/RichardRobertson/update-your-password/issues", | ||
"changelog": "https://github.com/RichardRobertson/update-your-password/blob/main/CHANGELOG.md" | ||
} | ||
{ | ||
"id": "update-your-password", | ||
"title": "Update Your Password", | ||
"description": "Allows users to update their own password", | ||
"authors": [ | ||
{ | ||
"name": "Richard Robertson", | ||
"url": "https://github.com/RichardRobertson" | ||
} | ||
], | ||
"version": "", | ||
"compatibility": { | ||
"minimum": 10, | ||
"verified": 12 | ||
}, | ||
"esmodules": [ | ||
"scripts/index.mjs" | ||
], | ||
"languages": [ | ||
{ | ||
"lang": "en", | ||
"name": "English", | ||
"path": "lang/en.json" | ||
} | ||
], | ||
"url": "https://github.com/RichardRobertson/update-your-password", | ||
"manifest": "https://github.com/RichardRobertson/update-your-password/releases/latest/download/module.json", | ||
"download": "https://github.com/RichardRobertson/update-your-password/releases/download/v__VERSION__/update-your-password-v__VERSION__.zip", | ||
"license": "LICENSE.md", | ||
"readme": "README.md", | ||
"bugs": "https://github.com/RichardRobertson/update-your-password/issues", | ||
"changelog": "https://github.com/RichardRobertson/update-your-password/blob/main/CHANGELOG.md" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,73 @@ | ||
'use strict'; | ||
|
||
function updatePasswordDialog() { | ||
new Dialog({ | ||
title: game.i18n.localize('update-your-password.dialog.title'), | ||
content: `<label for="new-password">${game.i18n.localize('update-your-password.dialog.label.contents')}</label><input id="new-password" type="password"><label for="confirm-new-password">${game.i18n.localize('update-your-password.dialog.confirm-label.contents')}</label><input id="confirm-new-password" type="password">`, | ||
buttons: { | ||
apply: { | ||
icon: '<i class="fas fa-check"></i>', | ||
label: game.i18n.localize('update-your-password.dialog.buttons.apply.label'), | ||
callback: async (html) => { | ||
const newPassword = html.find('#new-password')[0].value; | ||
const confirmPassword = html.find('#new-password')[0].value; | ||
if (newPassword !== confirmPassword) { | ||
ui.notifications.error('update-your-password.notifications.error.confirm-not-match', { localize: true}); | ||
return; | ||
} | ||
if (newPassword.length !== 0) { | ||
await game.user.update({ password: newPassword }); | ||
} | ||
} | ||
}, | ||
cancel: { | ||
icon: '<i class="fas fa-times"></i>', | ||
label: game.i18n.localize('update-your-password.dialog.buttons.cancel.label') | ||
} | ||
}, | ||
default: 'apply' | ||
}).render(true); | ||
} | ||
|
||
Hooks.on('init', function () { | ||
game.settings.register('update-your-password', 'show-token-tool', { | ||
name: 'update-your-password.settings.show-token-tool.name', | ||
hint: 'update-your-password.settings.show-token-tool.hint', | ||
scope: 'world', | ||
config: true, | ||
type: Boolean, | ||
default: true, | ||
requiresReload: true | ||
}); | ||
game.settings.register('update-your-password', 'show-user-context-menu', { | ||
name: 'update-your-password.settings.show-user-context-menu.name', | ||
hint: 'update-your-password.settings.show-user-context-menu.hint', | ||
scope: 'world', | ||
config: true, | ||
type: Boolean, | ||
default: true, | ||
requiresReload: true | ||
}); | ||
}); | ||
|
||
Hooks.on('getSceneControlButtons', function (controls) { | ||
if (game.settings.get('update-your-password', 'show-token-tool')) { | ||
let tokenControls = controls.find(x => x.name === 'token'); | ||
tokenControls.tools.push({ | ||
icon: 'fas fa-key', | ||
name: 'update-your-password', | ||
title: game.i18n.localize('update-your-password.tool.title'), | ||
button: true, | ||
onClick: updatePasswordDialog | ||
}); | ||
} | ||
}); | ||
|
||
Hooks.on('getUserContextOptions', function (html, contextOptions) { | ||
contextOptions.push({ | ||
name: game.i18n.localize('update-your-password.tool.title'), | ||
icon: '<i class="fas fa-key"></i>', | ||
callback: updatePasswordDialog, | ||
condition: html => html.attr('data-user-id') === game.userId && game.settings.get('update-your-password', 'show-user-context-menu') | ||
}); | ||
}); | ||
'use strict'; | ||
|
||
function updatePasswordDialog() { | ||
new Dialog({ | ||
title: game.i18n.localize('update-your-password.dialog.title'), | ||
content: `<label for="new-password">${game.i18n.localize('update-your-password.dialog.label.contents')}</label><input id="new-password" type="password"><label for="confirm-new-password">${game.i18n.localize('update-your-password.dialog.confirm-label.contents')}</label><input id="confirm-new-password" type="password">`, | ||
buttons: { | ||
apply: { | ||
icon: '<i class="fas fa-check"></i>', | ||
label: game.i18n.localize('update-your-password.dialog.buttons.apply.label'), | ||
callback: async (html) => { | ||
const newPassword = html.find('#new-password')[0].value; | ||
const confirmPassword = html.find('#new-password')[0].value; | ||
if (newPassword !== confirmPassword) { | ||
ui.notifications.error('update-your-password.notifications.error.confirm-not-match', { localize: true }); | ||
return; | ||
} | ||
if (newPassword.length !== 0) { | ||
await game.user.update({ password: newPassword }); | ||
} | ||
} | ||
}, | ||
cancel: { | ||
icon: '<i class="fas fa-times"></i>', | ||
label: game.i18n.localize('update-your-password.dialog.buttons.cancel.label') | ||
} | ||
}, | ||
default: 'apply' | ||
}).render(true); | ||
} | ||
|
||
Hooks.on('init', function () { | ||
game.settings.register('update-your-password', 'show-token-tool', { | ||
name: 'update-your-password.settings.show-token-tool.name', | ||
hint: 'update-your-password.settings.show-token-tool.hint', | ||
scope: 'world', | ||
config: true, | ||
type: Boolean, | ||
default: false, | ||
requiresReload: true | ||
}); | ||
game.settings.register('update-your-password', 'show-user-context-menu', { | ||
name: 'update-your-password.settings.show-user-context-menu.name', | ||
hint: 'update-your-password.settings.show-user-context-menu.hint', | ||
scope: 'world', | ||
config: true, | ||
type: Boolean, | ||
default: true, | ||
requiresReload: true | ||
}); | ||
}); | ||
|
||
Hooks.on('getSceneControlButtons', function (controls) { | ||
if (game.settings.get('update-your-password', 'show-token-tool')) { | ||
let tokenControls = controls.find(x => x.name === 'token'); | ||
tokenControls.tools.push({ | ||
icon: 'fas fa-key', | ||
name: 'update-your-password', | ||
title: game.i18n.localize('update-your-password.tool.title'), | ||
button: true, | ||
onClick: updatePasswordDialog | ||
}); | ||
} | ||
}); | ||
|
||
Hooks.on('getUserContextOptions', function (html, contextOptions) { | ||
contextOptions.push({ | ||
name: game.i18n.localize('update-your-password.tool.title'), | ||
icon: '<i class="fas fa-key"></i>', | ||
callback: updatePasswordDialog, | ||
condition: html => html.attr('data-user-id') === game.userId && game.settings.get('update-your-password', 'show-user-context-menu') | ||
}); | ||
}); |