define(["globalize","connectionManager","appRouter","emby-scroller","emby-input","emby-button"],function(globalize,connectionManager,appRouter){"use strict";function onBackClick(){appRouter.back()}function alertText(options){return require(["alert"]).then(function(responses){return responses[0](options)})}function onPasswordReset(){appRouter.beginConnectionWizard()}function processForgotPasswordResult(result){if(result.Success){var msg=globalize.translate("PasswordResetForUsers");return msg+="<br/>",msg+="<br/>",void alertText({html:msg+=result.UsersReset.join("<br/>"),title:globalize.translate("HeaderPasswordReset")}).then(onPasswordReset)}alertText({text:globalize.translate("InvalidForgotPasswordPin"),title:globalize.translate("HeaderPasswordReset")})}return function(view,params){view.querySelector(".btnCancel").addEventListener("click",onBackClick),view.querySelector("form").addEventListener("submit",function(e){var apiClient=connectionManager.currentApiClient();return apiClient.ajax({type:"POST",url:apiClient.getUrl("Users/ForgotPassword/Pin"),dataType:"json",data:{Pin:view.querySelector("#txtPin").value}}).then(processForgotPasswordResult),e.preventDefault(),!1})}});