TimeTrex/interface/html5/dist/portal-sign_in-PortalResetForgotPasswordController.bundle.js

1 line
12 KiB
JavaScript

"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["portal-sign_in-PortalResetForgotPasswordController"],{5866:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PortalResetForgotPasswordController\": () => (/* binding */ PortalResetForgotPasswordController)\n/* harmony export */ });\n/* harmony import */ var _views_TTBackboneView__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6739);\n/* harmony import */ var _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7526);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\n\nclass PortalResetForgotPasswordController extends _views_TTBackboneView__WEBPACK_IMPORTED_MODULE_0__.TTBackboneView {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tevents: {\n\t\t\t\t'click .portal-reset-forgot-password': 'resetForgotPassword'\n\t\t\t}\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinitialize( options ) {\n\t\tsuper.initialize( options );\n\t\tif ( options.callback ) {\n\t\t\tthis.callback = options.callback;\n\t\t}\n\t\t// var $this = this;\n\t\t// __non_webpack_require__( this._required_files, function() {\n\t\tthis.api = _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__/* .TTAPI.APIRecruitmentAuthentication */ .y.APIRecruitmentAuthentication;\n\t\tvar el = Global.loadWidget( 'views/portal/sign_in/PortalResetForgotPassword.html' );\n\t\tthis.setElement( _.template( el )() );\n\t\tthis.render();\n\t\t// } );\n\t}\n\n\trender() {\n\t\tvar $this = this;\n\t\tthis.$( '#new_password' ).focus();\n\t\tthis.$( '#confirm_password' ).unbind( 'keydown' ).bind( 'keydown', function( e ) {\n\t\t\tif ( e.keyCode === 13 ) {\n\t\t\t\t$this.resetForgotPassword();\n\t\t\t}\n\t\t} );\n\t\t$( 'body' ).append( this.$el );\n\t\tthis.$el.modal( {\n\t\t\t'show': true,\n\t\t\t'backdrop': 'static'\n\t\t} );\n\t\tthis.$el.on( 'hidden.bs.modal', function() {\n\t\t\t$this.removeView();\n\t\t} );\n\t}\n\n\tremoveView() {\n\t\tthis.$el.remove();\n\t\tLocalCacheData.setAllURLArgs( _.omit( LocalCacheData.getAllURLArgs(), 'sm' ) );\n\t\tLocalCacheData.setAllURLArgs( _.omit( LocalCacheData.getAllURLArgs(), 'key' ) );\n\t\tIndexViewController.instance.router.navigate( '#!m=PortalJobVacancy&company_id=' + LocalCacheData.getAllURLArgs().company_id, {\n\t\t\ttrigger: false,\n\t\t\treplace: true\n\t\t} );\n\t}\n\n\tresetForgotPassword() {\n\t\tvar $this = this;\n\t\tif ( this.getPassword() ) {\n\t\t\tvar password = this.getPassword();\n\t\t\tthis.api.passwordReset( LocalCacheData.getAllURLArgs().key,\n\t\t\t\tpassword.new_password,\n\t\t\t\tpassword.confirm_password\n\t\t\t\t, {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\tif ( !result.isValid() ) {\n\t\t\t\t\t\t\tvar details = result.getDetails();\n\t\t\t\t\t\t\tif ( !details ) {\n\t\t\t\t\t\t\t\tdetails = result.getDescription(); // If the details is empty, try to get description to show.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar error_string = '';\n\t\t\t\t\t\t\tif ( Global.isArray( details ) || typeof details === 'object' ) {\n\t\t\t\t\t\t\t\t$.each( details, function( index, val ) {\n\t\t\t\t\t\t\t\t\tif ( val.hasOwnProperty( 'error' ) ) {\n\t\t\t\t\t\t\t\t\t\tval = val.error;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvar i = 0;\n\t\t\t\t\t\t\t\t\tfor ( var key in val ) {\n\t\t\t\t\t\t\t\t\t\terror_string = error_string + val[key];\n\t\t\t\t\t\t\t\t\t\tif ( i > 0 ) {\n\t\t\t\t\t\t\t\t\t\t\terror_string += '<br>';\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terror_string = details;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$this.setError( $this.$( '#new_password' ), error_string );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this.$el.modal( 'hide' );\n\t\t\t\t\t\t\tif ( $this.callback ) {\n\t\t\t\t\t\t\t\t$this.callback();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t}\n\t}\n\n\tgetPassword() {\n\t\tvar new_password = this.$( '#new_password' );\n\t\tvar confirm_password = this.$( '#confirm_password' );\n\t\tif ( !new_password.val() ) {\n\t\t\tthis.setError( new_password, $.i18n._( 'New password can\\'t be empty' ) );\n\t\t\treturn false;\n\t\t} else {\n\t\t\tthis.clearError( new_password );\n\t\t}\n\t\tif ( new_password.val() !== confirm_password.val() ) {\n\t\t\tthis.setError( confirm_password, $.i18n._( 'New password does not match' ) );\n\t\t\treturn false;\n\t\t} else {\n\t\t\tthis.clearError( confirm_password );\n\t\t}\n\n\t\treturn {\n\t\t\tnew_password: new_password.val(),\n\t\t\tconfirm_password: confirm_password.val()\n\t\t};\n\t}\n\n\tsetError( widget, message ) {\n\t\twidget.css( 'border', '1px solid red' );\n\t\twidget.tooltip( {\n\t\t\ttitle: message\n\t\t} );\n\t\twidget.tooltip( 'show' );\n\t}\n\n\tclearError( widget ) {\n\t\twidget.css( 'border', '1px solid #ccc' );\n\t\twidget.tooltip( 'dispose' );\n\t}\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTg2Ni5qcyIsIm1hcHB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