@@ -1,39 +1,43 @@
 | 
			
		||||
<script>
 | 
			
		||||
  import {  AuthService } from "@odit/lfk-client-js";
 | 
			
		||||
  import { AuthService } from "@odit/lfk-client-js";
 | 
			
		||||
  import { _ } from "svelte-i18n";
 | 
			
		||||
  import Toastify from "toastify-js";
 | 
			
		||||
  import "toastify-js/src/toastify.css";
 | 
			
		||||
  import PasswordStrength from "../auth/PasswordStrength.svelte";
 | 
			
		||||
  import PasswordStrength, {
 | 
			
		||||
    password_strong_enough,
 | 
			
		||||
  } from "../auth/PasswordStrength.svelte";
 | 
			
		||||
  let state = "reset_in_progress";
 | 
			
		||||
  let password = "";
 | 
			
		||||
  export let params;
 | 
			
		||||
  function set_new_password() {
 | 
			
		||||
      if(password.trim() !== ""){
 | 
			
		||||
        Toastify({
 | 
			
		||||
          text: $_('password-reset-in-progress'),
 | 
			
		||||
          duration: 3500,
 | 
			
		||||
        }).showToast();
 | 
			
		||||
        AuthService.authControllerResetPassword(atob(params.resetkey),{ password })
 | 
			
		||||
    if (password.trim() !== "") {
 | 
			
		||||
      Toastify({
 | 
			
		||||
        text: $_("password-reset-in-progress"),
 | 
			
		||||
        duration: 3500,
 | 
			
		||||
      }).showToast();
 | 
			
		||||
      AuthService.authControllerResetPassword(atob(params.resetkey), {
 | 
			
		||||
        password,
 | 
			
		||||
      })
 | 
			
		||||
        .then((resp) => {
 | 
			
		||||
          Toastify({
 | 
			
		||||
            text: $_('password-reset-successful'),
 | 
			
		||||
            text: $_("password-reset-successful"),
 | 
			
		||||
            duration: 3500,
 | 
			
		||||
          }).showToast();
 | 
			
		||||
          state="reset_success";
 | 
			
		||||
          state = "reset_success";
 | 
			
		||||
        })
 | 
			
		||||
        .catch((err) => {
 | 
			
		||||
          state="reset_error";
 | 
			
		||||
          state = "reset_error";
 | 
			
		||||
        });
 | 
			
		||||
      } else {
 | 
			
		||||
    } else {
 | 
			
		||||
      Toastify({
 | 
			
		||||
        text: $_('please-provide-a-password'),
 | 
			
		||||
        text: $_("please-provide-a-password"),
 | 
			
		||||
        duration: 3500,
 | 
			
		||||
      }).showToast();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
{#if state==="reset_success"}
 | 
			
		||||
{#if state === 'reset_success'}
 | 
			
		||||
  <div class="min-h-screen flex items-center justify-center bg-gray-100">
 | 
			
		||||
    <div class="max-w-md w-full py-12 px-6">
 | 
			
		||||
      <img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
 | 
			
		||||
@@ -57,31 +61,31 @@
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
{:else if state==="reset_error"}
 | 
			
		||||
<div class="min-h-screen flex items-center justify-center bg-gray-100">
 | 
			
		||||
  <div class="max-w-md w-full py-12 px-6">
 | 
			
		||||
    <img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
 | 
			
		||||
    <p class="mt-6 text-lg text-center font-bold text-gray-900">
 | 
			
		||||
      {$_('application_name')}
 | 
			
		||||
    </p>
 | 
			
		||||
    <p class="mt-2 mb-2 text-sm text-center text-gray-900 font-bold">
 | 
			
		||||
      {$_('password-reset-failed')}
 | 
			
		||||
    </p>
 | 
			
		||||
    <p class="mt-2 mb-2 text-sm text-center text-gray-900">
 | 
			
		||||
      {$_('please-request-a-new-reset-mail')}
 | 
			
		||||
    </p>
 | 
			
		||||
    <div class="mt-6">
 | 
			
		||||
{:else if state === 'reset_error'}
 | 
			
		||||
  <div class="min-h-screen flex items-center justify-center bg-gray-100">
 | 
			
		||||
    <div class="max-w-md w-full py-12 px-6">
 | 
			
		||||
      <img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
 | 
			
		||||
      <p class="mt-6 text-lg text-center font-bold text-gray-900">
 | 
			
		||||
        {$_('application_name')}
 | 
			
		||||
      </p>
 | 
			
		||||
      <p class="mt-2 mb-2 text-sm text-center text-gray-900 font-bold">
 | 
			
		||||
        {$_('password-reset-failed')}
 | 
			
		||||
      </p>
 | 
			
		||||
      <p class="mt-2 mb-2 text-sm text-center text-gray-900">
 | 
			
		||||
        {$_('please-request-a-new-reset-mail')}
 | 
			
		||||
      </p>
 | 
			
		||||
      <div class="mt-6">
 | 
			
		||||
        <a
 | 
			
		||||
          href="/forgot_password/"
 | 
			
		||||
          class="text-center relative block w-full py-2 px-3 border border-transparent rounded-md text-white font-semibold bg-gray-800 hover:bg-gray-700 focus:bg-gray-900 focus:outline-none focus:shadow-outline sm:text-sm">
 | 
			
		||||
          {$_('request-a-new-reset-mail')}
 | 
			
		||||
        </a>
 | 
			
		||||
        <div class="mt-6">
 | 
			
		||||
          <a
 | 
			
		||||
            href="/forgot_password/"
 | 
			
		||||
            class="text-center relative block w-full py-2 px-3 border border-transparent rounded-md text-white font-semibold bg-gray-800 hover:bg-gray-700 focus:bg-gray-900 focus:outline-none focus:shadow-outline sm:text-sm">
 | 
			
		||||
            {$_('request-a-new-reset-mail')}
 | 
			
		||||
          </a>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
{:else if state==="reset_in_progress"}
 | 
			
		||||
{:else if state === 'reset_in_progress'}
 | 
			
		||||
  <div class="min-h-screen flex items-center justify-center bg-gray-100">
 | 
			
		||||
    <div class="max-w-md w-full py-12 px-6">
 | 
			
		||||
      <img style="height:10rem;" class="mx-auto" src="/lfk-logo.png" alt="" />
 | 
			
		||||
@@ -109,6 +113,8 @@
 | 
			
		||||
        <div class="mt-5">
 | 
			
		||||
          <button
 | 
			
		||||
            on:click={set_new_password}
 | 
			
		||||
            disabled={!password_strong_enough(password)}
 | 
			
		||||
            class:opacity-50={!password_strong_enough(password)}
 | 
			
		||||
            type="submit"
 | 
			
		||||
            class="relative block w-full py-2 px-3 border border-transparent rounded-md text-white font-semibold bg-gray-800 hover:bg-gray-700 focus:bg-gray-900 focus:outline-none focus:shadow-outline sm:text-sm">
 | 
			
		||||
            <span class="absolute left-0 inset-y pl-3">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user