webadmin: some cleanup for setup.html
This commit is contained in:
+5
-11
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var SetupController = function ($scope, Client) {
|
||||
$scope.initialized = false;
|
||||
$scope.disabled = false;
|
||||
|
||||
$scope.username = '';
|
||||
@@ -12,14 +13,11 @@ var SetupController = function ($scope, Client) {
|
||||
$scope.error = {};
|
||||
|
||||
$scope.submit = function () {
|
||||
console.debug('Try to create admin %s.', $scope.username);
|
||||
|
||||
$scope.error.name = null;
|
||||
$scope.error.password = null;
|
||||
$scope.error.passwordRepeat = null;
|
||||
|
||||
if (!$scope.username) {
|
||||
console.error('Username must not be empty');
|
||||
$scope.error.name = 'Username must not be empty';
|
||||
$scope.error.password = '';
|
||||
$scope.error.passwordRepeat = '';
|
||||
@@ -27,7 +25,6 @@ var SetupController = function ($scope, Client) {
|
||||
}
|
||||
|
||||
if ($scope.password !== $scope.passwordRepeat) {
|
||||
console.error('Passwords dont match.');
|
||||
$scope.error.name = '';
|
||||
$scope.error.passwordRepeat = 'Passwords do not match';
|
||||
$scope.passwordRepeat = '';
|
||||
@@ -35,9 +32,8 @@ var SetupController = function ($scope, Client) {
|
||||
}
|
||||
|
||||
$scope.disabled = true;
|
||||
Client.createAdmin($scope.username, $scope.password, $scope.email, function (error, result) {
|
||||
Client.createAdmin($scope.username, $scope.password, $scope.email, function (error) {
|
||||
if (error) {
|
||||
console.error('Unable to create user.', error);
|
||||
if (error.statusCode === 409) {
|
||||
$scope.error.name = 'Username already exists';
|
||||
$scope.disabled = false;
|
||||
@@ -45,21 +41,19 @@ var SetupController = function ($scope, Client) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.debug('Successfully create user', $scope.username);
|
||||
window.location.href = '/';
|
||||
});
|
||||
};
|
||||
|
||||
Client.setClientCredentials('cid-webadmin', 'unused');
|
||||
Client.isServerFirstTime(function (error, isFirstTime) {
|
||||
if (error) {
|
||||
console.error('Unable to connect.', error);
|
||||
return;
|
||||
}
|
||||
if (error) return;
|
||||
|
||||
if (!isFirstTime) {
|
||||
window.location.href = '/';
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.initialized = true;
|
||||
});
|
||||
};
|
||||
|
||||
+30
-17
@@ -4,36 +4,49 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
|
||||
|
||||
<title> YellowTent </title>
|
||||
<title> YellowTent </title>
|
||||
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- MetisMenu CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">
|
||||
<!-- MetisMenu CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Timeline CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/plugins/timeline.css" rel="stylesheet">
|
||||
<!-- Timeline CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/plugins/timeline.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/sb-admin-2.css" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/sb-admin-2.css" rel="stylesheet">
|
||||
|
||||
<!-- Morris Charts CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/plugins/morris.css" rel="stylesheet">
|
||||
<!-- Morris Charts CSS -->
|
||||
<link href="3rdparty/sb-admin-2/css/plugins/morris.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom Fonts -->
|
||||
<link href="3rdparty/sb-admin-2/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
||||
<!-- Custom Fonts -->
|
||||
<link href="3rdparty/sb-admin-2/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<style>
|
||||
|
||||
.animateMe {
|
||||
opacity: 1;
|
||||
transform: scale(1, 1);
|
||||
-webkit-transition: 0.25s linear all;
|
||||
transition: 0.25s linear all;
|
||||
}
|
||||
|
||||
<!-- application stylesheets -->
|
||||
<!-- <link href="css/index.css" rel="stylesheet" media="screen"> -->
|
||||
.animateMe.ng-hide-add,
|
||||
.animateMe.ng-hide-remove {
|
||||
display: block !important;
|
||||
transform: scale(0.9, 0.9);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
</head>
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body ng-app="YellowTent" ng-controller="SetupController">
|
||||
|
||||
<div class="container">
|
||||
<div class="container animateMe ng-hide" ng-show="initialized">
|
||||
<div class="row">
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6">
|
||||
|
||||
Reference in New Issue
Block a user