Login.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!-- Copyright (C) 2012-2021 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <template>
  3. <!-- TODO: Only a dummy implementation for the login... -->
  4. <div class="flex flex-col h-full min-h-screen items-center justify-center">
  5. <div class="max-w-sm w-full">
  6. <div class="m-auto">
  7. <div class="flex-grow flex flex-col justify-center">
  8. <p>{{ i18n.t('Log in with %s', config.get('fqdn') as string) }}</p>
  9. <div class="my-5 p-5 max-w-full bg-white flex-grow rounded-md">
  10. <div class="flex flex-col">
  11. <div class="flex justify-center p-4">
  12. <img
  13. class="w-32 h-32"
  14. src="@common/assets/logo.svg"
  15. alt="Zammad"
  16. />
  17. </div>
  18. <div class="text-left">
  19. <label class="block mt-4 cursor-pointer">
  20. <span class="text-gray-600 uppercase text-xs tracking-wide">
  21. {{ i18n.t('Username / Email') }}
  22. </span>
  23. <input
  24. v-model="loginFormValues.login"
  25. type="text"
  26. class="text-gray-700 mt-1 block w-full text-sm rounded border border-gray-200"
  27. />
  28. </label>
  29. <label class="block mt-4 cursor-pointer">
  30. <span class="text-gray-600 uppercase text-xs tracking-wide">
  31. {{ i18n.t('Password') }}
  32. </span>
  33. <input
  34. v-model="loginFormValues.password"
  35. type="password"
  36. class="text-gray-700 mt-1 block w-full text-sm rounded border border-gray-200"
  37. />
  38. </label>
  39. <label
  40. class="mt-4 cursor-pointer inline-flex items-center select-none"
  41. >
  42. <input type="checkbox" class="form-checkbox" checked />
  43. <span class="ml-2">{{ i18n.t('Remember me') }}</span>
  44. </label>
  45. </div>
  46. <div class="flex justify-between flex-grow items-baseline mt-4">
  47. <button
  48. class="bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded select-none"
  49. v-on:click="login"
  50. >
  51. {{ i18n.t('Sign in') }}
  52. </button>
  53. <a class="cursor-pointer select-none underline">
  54. {{ i18n.t('Forgot password?') }}
  55. </a>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="flex justify-center items-center align-baseline p-6">
  62. <a href="https://zammad.org" target="_blank">
  63. <CommonIcon name="logo" size="large" />
  64. </a>
  65. <span class="mx-1">{{ i18n.t('Powered by') }}</span>
  66. <a class="ml-1 -mt-1" href="https://zammad.org" target="_blank">
  67. <CommonIcon
  68. name="logotype"
  69. v-bind:fixed-size="{ width: 80, height: 14 }"
  70. />
  71. </a>
  72. </div>
  73. </div>
  74. </div>
  75. </template>
  76. <script setup lang="ts">
  77. import useApplicationConfigStore from '@common/stores/application/config'
  78. import useAuthenticationStore from '@common/stores/authenticated'
  79. import { useRouter } from 'vue-router'
  80. const authentication = useAuthenticationStore()
  81. const loginFormValues = {
  82. login: '',
  83. password: '',
  84. }
  85. const router = useRouter()
  86. const login = (): void => {
  87. authentication
  88. .login(loginFormValues.login, loginFormValues.password)
  89. .then(() => {
  90. router.replace('/')
  91. })
  92. }
  93. const config = useApplicationConfigStore()
  94. </script>