(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[78],{

/***/ "./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/user/Login.vue?vue&type=script&lang=js&":
/*!************************************************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/main/user/Login.vue?vue&type=script&lang=js& ***!
  \************************************************************************************************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_singles_BForm_component_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/singles/BForm/component.vue */ \"./src/components/singles/BForm/component.vue\");\n/* harmony import */ var _utils_auth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/utils/auth */ \"./src/utils/auth.js\");\n/* harmony import */ var _utils_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/utils/app */ \"./src/utils/app.js\");\n/* harmony import */ var _utils_fingerprint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/utils/fingerprint */ \"./src/utils/fingerprint.js\");\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n  components: {\n    BForm: _components_singles_BForm_component_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n  },\n  props: {\n    value: Boolean,\n    email: String\n  },\n  data() {\n    return {\n      isLoading: false,\n      fingerprint: null,\n      form: {\n        valid: false,\n        inputs: [{\n          focus: true,\n          icon: \"mdi-email\",\n          name: \"username\",\n          placeholder: \"Email\",\n          type: \"email\",\n          validation: \"\",\n          value: this.email || \"\"\n        }, {\n          icon: \"mdi-lock\",\n          name: \"password\",\n          placeholder: \"Password\",\n          type: \"password\",\n          validation: \"\",\n          value: \"\"\n        }]\n      }\n    };\n  },\n  computed: {\n    hasEmailAndPassword() {\n      return this.form.inputs.every(x => x.value);\n    },\n    ready() {\n      return this.$store.state.settings.server && this.fingerprint;\n    }\n  },\n  async mounted() {\n    this.isLoading = true;\n    this.$nextTick(async () => {\n      this.fingerprint = await _utils_fingerprint__WEBPACK_IMPORTED_MODULE_3__[\"default\"].get(true);\n    });\n    if (this.$store.state.auth.success) {\n      Object(_utils_auth__WEBPACK_IMPORTED_MODULE_1__[\"reroute\"])();\n    }\n    this.isLoading = false;\n  },\n  methods: {\n    async login() {\n      if (!this.form.valid || !this.hasEmailAndPassword) {\n        return;\n      }\n      this.isLoading = true;\n      try {\n        const res = await this.$helpers.postApi(\"login\", {\n          username: this.form.inputs[0].value.toLowerCase().trim(),\n          password: this.form.inputs[1].value,\n          fp: this.fingerprint\n        }, {\n          skipDataObject: true,\n          skipAuth: true,\n          fullDataObject: true\n        });\n        if (res.status === 201) {\n          this.$emit(\"complete\", {\n            ...res.data,\n            fingerprint: this.fingerprint,\n            mail: this.form.inputs[0].value.toLowerCase()\n          });\n          this.$emit(\"action\", \"twoFa\");\n        } else this.loginSuccessful(res.data);\n      } catch (err) {\n        this.loginError(err);\n      }\n    },\n    async loginSuccessful(user) {\n      try {\n        Object(_utils_auth__WEBPACK_IMPORTED_MODULE_1__[\"setAuth\"])(user);\n        this.$helpers.notify(`<span>Welcome!</span>`, \"\", \"success\");\n        await Object(_utils_app__WEBPACK_IMPORTED_MODULE_2__[\"loadSettings\"])();\n        Object(_utils_auth__WEBPACK_IMPORTED_MODULE_1__[\"reroute\"])();\n        this.isLoading = false;\n      } catch (err) {\n        console.error(err);\n      }\n    },\n    loginError(err) {\n      if (err.response && err.response.data) {\n        const data = err.response.data;\n        this.isLoading = false;\n        this.form.inputs[1].value = \"\";\n        this.form.inputs[1].valid = false;\n        if (data.countLeft) {\n          this.$helpers.notify(\"Incorrect email or password\", `${data.countLeft} more ${data.countLeft > 1 ? \"tries\" : \"try\"}  until locked out.`, \"warning\");\n        } else {\n          this.$helpers.notify(\"Locked out\", `You have to reset your password to be able to sign in again.`, \"danger\", -1);\n        }\n      }\n    }\n  }\n});\n\n//# sourceURL=webpack:///./src/components/main/user/Login.vue?./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options");

/***/ }),

/***/ "./node_modules/cache-loader/dist/cjs.js?{\"cacheDirectory\":\"node_modules/.cache/vue-loader\",\"cacheIdentifier\":\"7d40fa80-vue-loader-template\"}!./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/user/Login.vue?vue&type=template&id=49d2d28a&":
/*!********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d40fa80-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/main/user/Login.vue?vue&type=template&id=49d2d28a& ***!
  \********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return staticRenderFns; });\nvar render = function() {\n  var _vm = this\n  var _h = _vm.$createElement\n  var _c = _vm._self._c || _h\n  return _c(\"div\", { staticClass: \"card\" }, [\n    _vm._m(0),\n    _c(\"div\", { staticClass: \"card-content\" }, [\n      _c(\n        \"form\",\n        {\n          on: {\n            submit: function($event) {\n              $event.stopPropagation()\n              $event.preventDefault()\n              return _vm.login()\n            }\n          }\n        },\n        [\n          _c(\"BForm\", {\n            attrs: { elements: _vm.form, mode: \"lazy\" },\n            on: {\n              valid: function($event) {\n                _vm.form.valid = $event\n              },\n              submit: function($event) {\n                return _vm.login()\n              }\n            }\n          }),\n          _c(\"section\", { staticClass: \"footer-container\" }, [\n            _c(\n              \"button\",\n              {\n                staticClass: \"button is-primary\",\n                class: { \"is-loading\": _vm.isLoading || !_vm.ready },\n                attrs: {\n                  disabled:\n                    _vm.isLoading ||\n                    !_vm.hasEmailAndPassword ||\n                    !_vm.form.valid ||\n                    !_vm.ready,\n                  type: \"submit\"\n                }\n              },\n              [_vm._v(\" Sign in \")]\n            )\n          ])\n        ],\n        1\n      ),\n      _vm.ready\n        ? _c(\"section\", { staticClass: \"buttons-section\" }, [\n            _vm.$store.state.settings.server &&\n            _vm.$store.state.settings.server.resetPasswordEnabled\n              ? _c(\n                  \"button\",\n                  {\n                    staticClass: \"simple-button\",\n                    attrs: { type: \"button\" },\n                    on: {\n                      click: function($event) {\n                        return _vm.$emit(\"action\", \"reset\")\n                      }\n                    }\n                  },\n                  [_vm._v(\" Reset password \")]\n                )\n              : _vm._e(),\n            _vm.$store.state.settings.server &&\n            _vm.$store.state.settings.server.publicSignupEnabled\n              ? _c(\n                  \"button\",\n                  {\n                    staticClass: \"simple-button is-fullwidth\",\n                    attrs: { type: \"button\" },\n                    on: {\n                      click: function($event) {\n                        return _vm.$emit(\"action\", \"signup\")\n                      }\n                    }\n                  },\n                  [_vm._v(\" Sign up \")]\n                )\n              : _vm._e()\n          ])\n        : _vm._e()\n    ])\n  ])\n}\nvar staticRenderFns = [\n  function() {\n    var _vm = this\n    var _h = _vm.$createElement\n    var _c = _vm._self._c || _h\n    return _c(\"div\", { staticClass: \"card-header\" }, [\n      _c(\"span\", { staticClass: \"card-header-title\" }, [_vm._v(\"Sign in\")])\n    ])\n  }\n]\nrender._withStripped = true\n\n\n\n//# sourceURL=webpack:///./src/components/main/user/Login.vue?./node_modules/cache-loader/dist/cjs.js?%7B%22cacheDirectory%22:%22node_modules/.cache/vue-loader%22,%22cacheIdentifier%22:%227d40fa80-vue-loader-template%22%7D!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options");

/***/ }),

/***/ "./src/components/main/user/Login.vue":
/*!********************************************!*\
  !*** ./src/components/main/user/Login.vue ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Login_vue_vue_type_template_id_49d2d28a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Login.vue?vue&type=template&id=49d2d28a& */ \"./src/components/main/user/Login.vue?vue&type=template&id=49d2d28a&\");\n/* harmony import */ var _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Login.vue?vue&type=script&lang=js& */ \"./src/components/main/user/Login.vue?vue&type=script&lang=js&\");\n/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ \"./node_modules/vue-loader/lib/runtime/componentNormalizer.js\");\n\n\n\n\n\n/* normalize component */\n\nvar component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(\n  _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n  _Login_vue_vue_type_template_id_49d2d28a___WEBPACK_IMPORTED_MODULE_0__[\"render\"],\n  _Login_vue_vue_type_template_id_49d2d28a___WEBPACK_IMPORTED_MODULE_0__[\"staticRenderFns\"],\n  false,\n  null,\n  null,\n  null\n  \n)\n\n/* hot reload */\nif (false) { var api; }\ncomponent.options.__file = \"src/components/main/user/Login.vue\"\n/* harmony default export */ __webpack_exports__[\"default\"] = (component.exports);\n\n//# sourceURL=webpack:///./src/components/main/user/Login.vue?");

/***/ }),

/***/ "./src/components/main/user/Login.vue?vue&type=script&lang=js&":
/*!*********************************************************************!*\
  !*** ./src/components/main/user/Login.vue?vue&type=script&lang=js& ***!
  \*********************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_cache_loader_dist_cjs_js_ref_12_0_node_modules_babel_loader_lib_index_js_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/babel-loader/lib!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib??vue-loader-options!./Login.vue?vue&type=script&lang=js& */ \"./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/user/Login.vue?vue&type=script&lang=js&\");\n/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__[\"default\"] = (_node_modules_cache_loader_dist_cjs_js_ref_12_0_node_modules_babel_loader_lib_index_js_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[\"default\"]); \n\n//# sourceURL=webpack:///./src/components/main/user/Login.vue?");

/***/ }),

/***/ "./src/components/main/user/Login.vue?vue&type=template&id=49d2d28a&":
/*!***************************************************************************!*\
  !*** ./src/components/main/user/Login.vue?vue&type=template&id=49d2d28a& ***!
  \***************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_cache_loader_dist_cjs_js_cacheDirectory_node_modules_cache_vue_loader_cacheIdentifier_7d40fa80_vue_loader_template_node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_template_id_49d2d28a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/cache-loader/dist/cjs.js?{\"cacheDirectory\":\"node_modules/.cache/vue-loader\",\"cacheIdentifier\":\"7d40fa80-vue-loader-template\"}!../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib??vue-loader-options!./Login.vue?vue&type=template&id=49d2d28a& */ \"./node_modules/cache-loader/dist/cjs.js?{\\\"cacheDirectory\\\":\\\"node_modules/.cache/vue-loader\\\",\\\"cacheIdentifier\\\":\\\"7d40fa80-vue-loader-template\\\"}!./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/user/Login.vue?vue&type=template&id=49d2d28a&\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return _node_modules_cache_loader_dist_cjs_js_cacheDirectory_node_modules_cache_vue_loader_cacheIdentifier_7d40fa80_vue_loader_template_node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_template_id_49d2d28a___WEBPACK_IMPORTED_MODULE_0__[\"render\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return _node_modules_cache_loader_dist_cjs_js_cacheDirectory_node_modules_cache_vue_loader_cacheIdentifier_7d40fa80_vue_loader_template_node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_template_id_49d2d28a___WEBPACK_IMPORTED_MODULE_0__[\"staticRenderFns\"]; });\n\n\n\n//# sourceURL=webpack:///./src/components/main/user/Login.vue?");

/***/ }),

/***/ "./src/utils/fingerprint.js":
/*!**********************************!*\
  !*** ./src/utils/fingerprint.js ***!
  \**********************************/
/*! exports provided: get, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"get\", function() { return get; });\nfunction init() {\n  return new Promise((resolve, reject) => {\n    try {\n      let script = document.getElementById(\"fp\");\n      if (!script) {\n        script = document.createElement(\"script\");\n        script.setAttribute(\"src\", \"/fp.js\");\n        script.setAttribute(\"id\", \"fp\");\n        document.head.appendChild(script);\n        script.onload = async () => {\n          resolve();\n        };\n      } else resolve();\n    } catch (err) {\n      reject(err);\n    }\n  });\n}\nfunction waitForIdle() {\n  return new Promise(resolve => {\n    if (window.requestIdleCallback) {\n      requestIdleCallback(() => {\n        resolve();\n      });\n    } else {\n      setTimeout(() => {\n        resolve();\n      }, 500);\n    }\n  });\n}\nasync function get(waitForReady) {\n  try {\n    await init();\n    if (waitForReady) await waitForIdle();\n    const components = await FP.getPromise({\n      excludes: {\n        adBlock: true,\n        webgl: false,\n        enumerateDevices: true\n      }\n    });\n    return FP.x64hash128(components.map(component => component.value).join(\"\"));\n  } catch (err) {\n    console.log(err);\n    throw err;\n  }\n}\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n  get\n});\n\n//# sourceURL=webpack:///./src/utils/fingerprint.js?");

/***/ })

}]);