mirror of
https://github.com/r4sas/recastin-panel
synced 2025-08-26 13:31:47 +00:00
REC-4 - Optimize login
This commit is contained in:
parent
cbad699ed6
commit
91c17420b3
@ -1,48 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="content">
|
<div class="loginWrapper">
|
||||||
<div class="container">
|
<div class="sidebarBanner"></div>
|
||||||
<div class="row">
|
<div class="loginForm">
|
||||||
<div class="col-md-12">
|
<h4>Login</h4>
|
||||||
<card>
|
|
||||||
<div class="alert alert-danger" v-if="authFailed">Bad credentials</div>
|
|
||||||
|
|
||||||
<fg-input type="text"
|
<div class="alert alert-danger" v-if="authFailed">Bad credentials</div>
|
||||||
label="Username"
|
|
||||||
placeholder="Username"
|
|
||||||
v-model="login._username">
|
|
||||||
</fg-input>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<fg-input type="text"
|
||||||
<label class="control-label">Password</label>
|
label="Username"
|
||||||
<input type="password" class="form-control" placeholder="Password" v-model="login._password">
|
placeholder="Username"
|
||||||
</div>
|
v-model="login._username">
|
||||||
<div class="form-group">
|
</fg-input>
|
||||||
<div class="peers ai-c jc-sb fxw-nw">
|
|
||||||
<div class="peer">
|
<div class="form-group">
|
||||||
<div class="checkbox checkbox-circle checkbox-info peers ai-c">
|
<label class="control-label">Password</label>
|
||||||
<input type="checkbox" id="inputCall1" name="inputCheckboxesCall" class="peer">
|
<input type="password" class="form-control" placeholder="Password" v-model="login._password">
|
||||||
<label
|
|
||||||
for="inputCall1" class="peers peer-greed js-sb ai-c"><span class="peer peer-greed">Remember Me</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="peer">
|
|
||||||
<button class="btn btn-primary" v-on:click="onLogin">Login</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</card>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<p-checkbox v-model="rememberMe">Remember Me</p-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" v-on:click="onLogin">Login</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import PCheckbox from 'src/components/UIComponents/Inputs/Checkbox.vue'
|
||||||
import Card from 'src/components/UIComponents/Cards/Card.vue'
|
import Card from 'src/components/UIComponents/Cards/Card.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Card
|
Card,
|
||||||
|
PCheckbox
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -50,6 +40,7 @@
|
|||||||
_username: 'Shyim',
|
_username: 'Shyim',
|
||||||
_password: '1',
|
_password: '1',
|
||||||
},
|
},
|
||||||
|
rememberMe: false,
|
||||||
authFailed: false
|
authFailed: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -61,13 +52,53 @@
|
|||||||
|
|
||||||
this.$auth.login({
|
this.$auth.login({
|
||||||
data: bodyFormData,
|
data: bodyFormData,
|
||||||
rememberMe: true,
|
rememberMe: this.rememberMe,
|
||||||
redirect: {name: 'Overview'}
|
redirect: {name: 'Overview'},
|
||||||
|
error: () => {
|
||||||
|
const notification = {
|
||||||
|
template: `<span>Login failed</span>`
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
component: notification,
|
||||||
|
icon: 'fa fa-exclamation-triangle',
|
||||||
|
horizontalAlign: 'right',
|
||||||
|
verticalAlign: 'top',
|
||||||
|
type: 'danger'
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
.loginWrapper {
|
||||||
|
height: 100vh;
|
||||||
|
align-items: stretch;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
box-sizing: border-box;
|
||||||
|
justify-content: flex-start;
|
||||||
|
display: flex;
|
||||||
|
flex-flow: nowrap;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginForm {
|
||||||
|
flex: 1 0 auto;
|
||||||
|
padding: 80px 40px 80px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebarBanner {
|
||||||
|
background-image: url("/static/img/bg.jpg");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
background-size: cover;
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
flex: 4 1 auto;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -4,6 +4,8 @@ import App from './App.vue'
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import VueAxios from 'vue-axios'
|
import VueAxios from 'vue-axios'
|
||||||
import VueAuth from '@websanova/vue-auth'
|
import VueAuth from '@websanova/vue-auth'
|
||||||
|
import VueNotify from 'vue-notifyjs'
|
||||||
|
import 'vue-notifyjs/themes/default.css'
|
||||||
|
|
||||||
|
|
||||||
// router setup
|
// router setup
|
||||||
@ -25,6 +27,7 @@ Vue.router = router;
|
|||||||
axios.defaults.baseURL = `http://streamer.miku/api`;
|
axios.defaults.baseURL = `http://streamer.miku/api`;
|
||||||
|
|
||||||
Vue.use(VueAxios, axios);
|
Vue.use(VueAxios, axios);
|
||||||
|
Vue.use(VueNotify);
|
||||||
Vue.use(VueAuth, {
|
Vue.use(VueAuth, {
|
||||||
auth: {
|
auth: {
|
||||||
request: function (req, token) {
|
request: function (req, token) {
|
||||||
|
BIN
public/theme/static/img/bg.jpg
Normal file
BIN
public/theme/static/img/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 454 KiB |
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Component\ServiceManager;
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
@ -19,16 +20,17 @@ class Dashboard extends Controller
|
|||||||
* @Route(path="/stats")
|
* @Route(path="/stats")
|
||||||
* @author Soner Sayakci <shyim@posteo.de>
|
* @author Soner Sayakci <shyim@posteo.de>
|
||||||
* @param Connection $connection
|
* @param Connection $connection
|
||||||
|
* @param ServiceManager $manager
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws \Doctrine\DBAL\DBALException
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function index(Connection $connection)
|
public function index(Connection $connection, ServiceManager $manager)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
$data['streams'] = $connection->fetchColumn('SELECT COUNT(*) FROM streams');
|
$data['streams'] = $connection->fetchColumn('SELECT COUNT(*) FROM streams');
|
||||||
$data['liveStreams'] = $connection->fetchColumn('SELECT COUNT(*) FROM streams WHERE live = 1');
|
$data['liveStreams'] = $connection->fetchColumn('SELECT COUNT(*) FROM streams WHERE live = 1');
|
||||||
$data['users'] = $connection->fetchColumn('SELECT COUNT(*) FROM `user`');
|
$data['users'] = $connection->fetchColumn('SELECT COUNT(*) FROM `user`');
|
||||||
$data['endpoints'] = $connection->fetchColumn('SELECT COUNT(*) FROM endpoint');
|
$data['endpoints'] = \count($manager->getTemplateData());
|
||||||
|
|
||||||
return new JsonResponse($data);
|
return new JsonResponse($data);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user