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

1 line
12 KiB
JavaScript

"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\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tshowErrorAlert( result ) {\n\t\tvar details = result.getDetails();\n\t\t// if ( details.hasOwnProperty( 'error' ) ) {\n\t\t//\n\t\t// }\n\t\tif ( !details ) {\n\t\t\tdetails = result.getDescription(); // If the details is empty, try to get description to show.\n\t\t}\n\t\tvar error_string = '';\n\n\t\tif ( Global.isArray( details ) || typeof details === 'object' ) {\n\n\t\t\t$.each( details, function( index, val ) {\n\n\t\t\t\tif ( val.hasOwnProperty( 'error' ) ) {\n\t\t\t\t\tval = val.error;\n\t\t\t\t}\n\n\t\t\t\tfor ( var key in val ) {\n\t\t\t\t\terror_string = error_string + val[key] + '<br>';\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\n\t\t\terror_string = details;\n\t\t}\n\t\tIndexViewController.instance.router.showTipModal( error_string );\n\t}\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAwMi5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDtBQUNBLElBQUk7O0FBRUo7QUFDQTs7QUFFQTtBQUNBOztBQUVBLGVBQWUsQ0FBQztBQUNoQjtBQUNBO0FBQ0E7QUFDQTtBQUNBLElBQUk7QUFDSjtBQUNBO0FBQ0E7QUFDQT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