Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds web options to support better password resets #211

Merged
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- [nkmerrill](https://github.com/nkmerrill)
- [TtheCreator](https://github.com/Tthecreator)
- [RazeLighter777](https://github.com/RazeLighter777)
- [anthonylavado](https://github.com/anthonylavado)
- [LogicalPhallacy](https://github.com/LogicalPhallacy)

# Emby Contributors

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/forgotpassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define([], function() {
});
if ("PinCode" == result.Action) {
var msg = Globalize.translate("MessageForgotPasswordFileCreated");
return msg += "<br/>", msg += "<br/>", msg += result.PinFile, msg += "<br/>", void Dashboard.alert({
return msg += "<br/>", msg += "<br/>", msg += "<a href=\"forgotpasswordpin.html\">Enter PIN here to finish Password Reset</a>" ,msg += "<br/>",msg += result.PinFile, msg += "<br/>", void Dashboard.alert({
message: msg,
title: Globalize.translate("HeaderForgotPassword")
})
Expand Down
17 changes: 17 additions & 0 deletions src/scripts/useredit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,27 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked"], function($, loading, l
})
}

function loadPasswordResetProviders(page, user, providers) {
if (providers.length > 1 && !user.Policy.IsAdministrator) {
page.querySelector(".fldSelectPasswordResetProvider").classList.remove("hide");
} else {
page.querySelector(".fldSelectPasswordResetProvider").classList.add("hide");
}
var currentProviderId = user.Policy.PasswordResetProviderId;
page.querySelector(".selectPasswordResetProvider").innerHTML = providers.map(function(provider) {
var selected = (provider.Id === currentProviderId || providers.length < 2) ? " selected" : "";
return '<option value="' + provider.Id + '"' + selected + ">" + provider.Name + "</option>"
})
}

function loadUser(page, user) {
currentUser = user;
ApiClient.getJSON(ApiClient.getUrl("Auth/Providers")).then(function(providers) {
loadAuthProviders(page, user, providers)
});
ApiClient.getJSON(ApiClient.getUrl("Auth/PasswordResetProviders")).then(function(providers) {
loadPasswordResetProviders(page, user, providers)
});
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", {
IsHidden: false
})).then(function(folders) {
Expand Down Expand Up @@ -92,6 +108,7 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked"], function($, loading, l
user.Policy.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($("#txtRemoteClientBitrateLimit", page).val() || "0"));
user.Policy.LoginAttemptsBeforeLockout = parseInt($("#txtLoginAttemptsBeforeLockout", page).val() || "0");
user.Policy.AuthenticationProviderId = page.querySelector(".selectLoginProvider").value;
user.Policy.PasswordResetProviderId = page.querySelector(".selectPasswordResetProvider").value;
user.Policy.EnableContentDeletion = $("#chkEnableDeleteAllFolders", page).checked();
user.Policy.EnableContentDeletionFromFolders = user.Policy.EnableContentDeletion ? [] : $(".chkFolder", page).get().filter(function(c) {
return c.checked
Expand Down
6 changes: 5 additions & 1 deletion src/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"AspectRatio": "Aspect ratio",
"AttributeNew": "New",
"Audio": "Audio",
"AuthProviderHelp": "Select an Authentication Provider to be used to authenticate this user's password",
"Auto": "Auto",
"AutoBasedOnLanguageSetting": "Auto (based on language setting)",
"Backdrop": "Backdrop",
Expand Down Expand Up @@ -548,6 +549,7 @@
"LabelArtistsHelp": "Separate multiple using ;",
"LabelAudio": "Audio:",
"LabelAudioLanguagePreference": "Preferred audio language:",
"LabelAuthProvider": "Authentication Provider:",
"LabelAutomaticallyRefreshInternetMetadataEvery": "Automatically refresh metadata from the internet:",
"LabelBindToLocalNetworkAddress": "Bind to local network address:",
"LabelBindToLocalNetworkAddressHelp": "Optional. Override the local IP address to bind the http server to. If left empty, the server will bind to all availabile addresses. Changing this value requires restarting Jellyfin Server.",
Expand Down Expand Up @@ -746,6 +748,7 @@
"LabelParentalRating": "Parental rating:",
"LabelPassword": "Password:",
"LabelPasswordConfirm": "Password (confirm):",
"LabelPasswordResetProvider": "Password Reset Provider:",
"LabelPasswordRecoveryPinCode": "Pin code:",
"LabelPath": "Path:",
"LabelPersonRole": "Role:",
Expand Down Expand Up @@ -961,7 +964,7 @@
"MessageNoServersAvailableToConnect": "No servers are available to connect to. If you've been invited to share a server, make sure to accept it below or by clicking the link in the email.",
"MessageNoTrailersFound": "No trailers found. Install the Trailer channel to enhance your movie experience by adding a library of internet trailers.",
"MessageNothingHere": "Nothing here.",
"MessagePasswordResetForUsers": "Passwords have been removed for the following users. To login, sign in with a blank password.",
"MessagePasswordResetForUsers": "The following users have had their passwords reset. They can now sign in with the PIN codes that were used to perform the reset.",
"MessagePlayAccessRestricted": "Playback of this content is currently restricted. Please contact your Jellyfin Server administrator for more information.",
"MessagePleaseEnsureInternetMetadata": "Please ensure downloading of internet metadata is enabled.",
"MessagePleaseWait": "Please wait. This may take a minute.",
Expand Down Expand Up @@ -1170,6 +1173,7 @@
"PasswordResetComplete": "The password has been reset.",
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
"PasswordResetHeader": "Reset Password",
"PasswordResetProviderHelp": "Choose a Password Reset Provider to be used when this user requests a password reset",
"PasswordSaved": "Password saved.",
"People": "People",
"PerfectMatch": "Perfect match",
Expand Down
6 changes: 6 additions & 0 deletions src/useredit.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ <h2 class="sectionTitle username"></h2>
<select class="selectLoginProvider" is="emby-select" label="${LabelAuthProvider}"></select>
<div class="fieldDescription">${AuthProviderHelp}</div>
</div>

<div class="selectContainer fldSelectPasswordResetProvider hide">
<select class="selectPasswordResetProvider" is="emby-select" label="${LabelPasswordResetProvider}"></select>
<div class="fieldDescription">${PasswordResetProviderHelp}</div>
</div>

<div class="checkboxContainer checkboxContainer-withDescription fldRemoteAccess hide">
<label>
<input type="checkbox" is="emby-checkbox" id="chkRemoteAccess" />
Expand Down