Get things into a somewhat working state on the login form

This commit is contained in:
Dane Everitt 2018-03-31 15:52:11 -05:00
parent 7de2c8684c
commit 791cbaa5ce
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
15 changed files with 450 additions and 132 deletions

View file

@ -1,27 +0,0 @@
/**
* This injects Tailwind's base styles, which is a combination of
* Normalize.css and some additional base styles.
*/
@import "tailwindcss/preflight";
/**
* This injects any component classes registered by plugins.
*/
@import "tailwindcss/components";
/**
* Here you would add any of your custom component classes; stuff that you'd
* want loaded *before* the utilities so that the utilities could still
* override them.
*/
/**
* This injects all of Tailwind's utility classes, generated based on your
* config file.
*/
@import "tailwindcss/utilities";
/**
* Here you would add any custom utilities you need that don't come out of the
* box with Tailwind.
*/

View file

@ -0,0 +1,46 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
import { Ziggy } from './helpers/ziggy';
// Base Vuejs Templates
import Login from './components/auth/Login';
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Ziggy = Ziggy;
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
const route = require('./../../../../vendor/tightenco/ziggy/src/js/route').default;
Vue.config.productionTip = false;
Vue.mixin({
methods: {
route: route,
},
});
Vue.use(VueRouter);
const router = new VueRouter({
routes: [
{
path: '/:action?',
component: Login,
}
]
});
const app = new Vue({
router,
}).$mount('#pterodactyl');

View file

@ -0,0 +1,35 @@
window._ = require('lodash');
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
window.$ = window.jQuery = require('jquery');
} catch (e) {}
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found in document.');
}

View file

@ -0,0 +1,41 @@
<template>
<div>
<form class="bg-white shadow-lg rounded-lg pt-10 px-8 pb-6 mb-4 animate fadein" method="post">
<div class="flex flex-wrap -mx-3 mb-6">
<div class="input-open">
<input class="input" id="grid-email" type="text" aria-labelledby="grid-email" required
v-bind:value="email"
v-on:input="updateEmail($event)"
/>
<label for="grid-email">Email</label>
<p class="text-grey-darker text-xs">Enter your account email address to recive instructions on resetting your password.</p>
</div>
</div>
<div>
<button class="bg-blue hover:bg-blue-dark hover:border-blue-darker border-blue-dark border text-white p-4 rounded w-full uppercase tracking-wide text-sm"
type="submit">
Recover Account
</button>
</div>
<div class="pt-6 text-center">
<router-link to="/" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark">
Go to Login
</router-link>
</div>
</form>
</div>
</template>
<script>
export default {
name: 'forgot-password',
props: {
email: {type: String, required: true},
},
methods: {
updateEmail: function (event) {
this.$emit('update-email', event.target.value);
}
}
}
</script>

View file

@ -0,0 +1,37 @@
<template>
<div>
<login-form
v-if="this.$route.path === '/'"
v-bind:email="email"
v-on:update-email="onEmailUpdate"
/>
<forgot-password
v-if="this.$route.path === '/forgot-password'"
v-bind:email="email"
v-on:update-email="onEmailUpdate"
/>
</div>
</template>
<script>
import LoginForm from "./LoginForm";
import ForgotPassword from "./ForgotPassword";
export default {
name: 'login',
data: function () {
return {
email: '',
};
},
methods: {
onEmailUpdate: function (value) {
this.$data.email = value;
},
},
components: {
ForgotPassword,
LoginForm
},
}
</script>

View file

@ -0,0 +1,45 @@
<template>
<div>
<form class="bg-white shadow-lg rounded-lg pt-10 px-8 pb-6 mb-4 animate fadein" :action="route('auth.login')" method="post">
<div class="flex flex-wrap -mx-3 mb-6">
<div class="input-open">
<input class="input" id="grid-username" type="text" name="user" aria-labelledby="grid-username" required
v-bind:value="email"
v-on:input="updateEmail($event)"
/>
<label for="grid-username">Username or Email</label>
</div>
</div>
<div class="flex flex-wrap -mx-3 mb-6">
<div class="input-open">
<input class="input" id="grid-password" type="password" name="password" aria-labelledby="grid-password" required>
<label for="grid-password">Password</label>
</div>
</div>
<div>
<button class="bg-blue hover:bg-blue-dark hover:border-blue-darker border-blue-dark border text-white p-4 rounded w-full uppercase tracking-wide text-sm" type="submit">
Sign In
</button>
</div>
<div class="pt-6 text-center">
<router-link to="/forgot-password" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark">
Forgot Password?
</router-link>
</div>
</form>
</div>
</template>
<script>
export default {
name: 'login-form',
props: {
email: { type: String, required: true },
},
methods: {
updateEmail: function (event) {
this.$emit('update-email', event.target.value);
}
}
}
</script>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
.animate {
&.fadein {
animation: fadein 500ms;
}
}
@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}

View file

@ -0,0 +1,37 @@
.input-open {
@apply .w-full .px-3 .relative;
}
.input-open > .input {
@apply .appearance-none .block .w-full .text-grey-darker .border-b-2 .border-grey-light .py-3 .mb-3;
&:focus {
@apply .border-blue;
outline: 0;
transition: border 500ms ease-out;
}
&:focus + label, &:valid + label {
@apply .text-grey-darker .px-0 .cursor-pointer;
transform:translateY(-24px)
}
&:invalid + label {
@apply .text-grey .px-1;
transform:translateY(0)
}
&:required {
box-shadow: none;
}
}
.input-open > label {
@apply .block .uppercase .tracking-wide .text-grey .text-xs .mb-2 .absolute .px-1;
top: 14px;
transition: transform 200ms ease-out;
}
.login-box {
@apply .bg-white .shadow-lg .rounded-lg .pt-10 .px-8 .pb-6 .mb-4;
}

View file

@ -0,0 +1,23 @@
/**
* Tailwind Preflight Classes
*/
@import "tailwindcss/preflight";
@import "tailwindcss/components";
/**
* Pterodactyl Specific CSS
*/
@import "components/animations.css";
@import "components/authentication.css";
/**
* Tailwind Utilities
*/
@import "tailwindcss/utilities";
/**
* Assorted Other CSS
*/
body {
@apply .font-sans;
}