TimeTrex/interface/html5/dist/wizard-forgot_password-ForgotPasswordWizardController.bundle.js

1 line
12 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-forgot_password-ForgotPasswordWizardController"],{1002:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ForgotPasswordWizardController\": () => (/* binding */ ForgotPasswordWizardController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass ForgotPasswordWizardController extends BaseWizardController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '.wizard-bg'\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit() {\n\t\t//this._super('initialize' );\n\n\t\tthis.title = $.i18n._( 'Password Reset' );\n\t\tthis.steps = 1;\n\t\tthis.current_step = 1;\n\t\tif ( this.default_data && typeof this.default_data.api_class != 'undefined' ) {\n\t\t\tthis.api = this.default_data.api_class;\n\t\t} else {\n\t\t\tthis.api = TTAPI.APIAuthentication;\n\t\t}\n\t\tthis.render();\n\t}\n\n\trender() {\n\t\tvar $this = this;\n\t\tsuper.render();\n\n\t\t// $( this.el ).css( {left: ( Global.bodyWidth() - $(this.el ).width() )/2} );\n\n//\t\tthis.content_div.css( {height: $(this.el ).height() - 145} );\n\n// \t\t$( window ).resize( function() {\n// \t\t\t// $( $this.el ).css( {left: ( Global.bodyWidth() - $($this.el ).width() )/2} );\n// //\t\t\t$this.content_div.css( {height: $($this.el ).height() - 145} );\n// \t\t} );\n\n\t\tthis.initCurrentStep();\n\t}\n\n\tbuildCurrentStepUI() {\n\n\t\tvar $this = this;\n\t\tthis.content_div.empty();\n\n\t\tthis.stepsWidgetDic[this.current_step] = {};\n\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tvar form_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tvar form_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tvar form_item_input_div = form_item.find( '.form-item-input-div' );\n\t\t\t\tvar item = this.getTextInput( 'email' );\n\t\t\t\tform_item_label.text( $.i18n._( 'Email Address' ) );\n\t\t\t\tform_item_input_div.unbind( 'keydown' ).bind( 'keydown', function( e ) {\n\t\t\t\t\tif ( e.keyCode === 13 ) {\n\t\t\t\t\t\t$this.onDoneClick();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tform_item_input_div.append( item );\n\t\t\t\tthis.content_div.append( form_item );\n\t\t\t\tthis.stepsWidgetDic[this.current_step][item.getField()] = item;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][item.getField()].focus();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsaveCurrentStep() {\n\t\tthis.stepsDataDic[this.current_step] = {};\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\tswitch ( this.current_step ) {\n\t\t\tdefault:\n\t\t\t\tfor ( var key in current_step_ui ) {\n\t\t\t\t\tif ( !current_step_ui.hasOwnProperty( key ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent_step_data[key] = current_step_ui[key].getValue();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tbuildCurrentStepData() {\n\t}\n\n\tonCloseClick() {\n\t\t$( this.el ).remove();\n\t\tLocalCacheData.current_open_wizard_controllers = LocalCacheData.current_open_wizard_controllers.filter( wizard => wizard.wizard_id !== this.wizard_id );\n\t\tLocalCacheData.extra_filter_for_next_open_view = null;\n\t}\n\n\tonDoneClick() {\n\t\tvar $this = this;\n\t\tsuper.onDoneClick();\n\t\tthis.saveCurrentStep();\n\n\t\tvar email = this.stepsDataDic[1].email;\n\n\t\tthis.stepsWidgetDic[1].email.clearErrorStyle();\n\n\t\tif ( !email ) {\n\t\t\tthis.stepsWidgetDic[1].email.setErrorStyle( $.i18n._( 'Email must be specified' ), true );\n\t\t} else {\n\t\t\tthis.api.resetPassword( email, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tif ( !result.isValid() ) {\n\t\t\t\t\t\tTAlertManager.showErrorAlert( result );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this.onCloseClick();\n\t\t\t\t\t\tif ( $this.call_back ) {\n\t\t\t\t\t\t\t$this.call_back( result );\n\t\t\t