work on account registration
This commit is contained in:
@@ -14,7 +14,7 @@ function (angular, config, _, $, store) {
|
||||
|
||||
$scope.grafanaVersion = grafanaVersion[0] === '@' ? 'master' : grafanaVersion;
|
||||
$scope.consoleEnabled = store.getBool('grafanaConsole');
|
||||
$scope.showProSideMenu = store.getBool('grafanaProSideMenu');
|
||||
//$scope.showProSideMenu = store.getBool('grafanaProSideMenu');
|
||||
|
||||
$rootScope.profilingEnabled = store.getBool('profilingEnabled');
|
||||
$rootScope.performance = { loadStart: new Date().getTime() };
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
|
||||
<div class="login-box-logo">
|
||||
<img src="/img/logo_transparent_200x75.png">
|
||||
<h3>Grafana account registration</32>
|
||||
</div>
|
||||
|
||||
<div class="text-center" style="margin-bottom: 50px">
|
||||
<h3>Account registration</32>
|
||||
</div>
|
||||
|
||||
<form name="loginForm" class="form-horizontal">
|
||||
@@ -31,7 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<button type="submit" ng-click="login()" class="btn btn-success btn-large">
|
||||
<button type="submit" ng-click="register()" class="btn btn-success btn-large">
|
||||
<i class="icon-lock"></i>
|
||||
Sign up
|
||||
</button>
|
||||
|
||||
@@ -30,20 +30,16 @@ function (angular) {
|
||||
$scope.register = function() {
|
||||
delete $scope.registerError;
|
||||
|
||||
if (!$scope.loginForm.$valid) {
|
||||
if (!$scope.loginForm.$valid) { return; }
|
||||
if ($scope.loginModel.password !== $scope.loginModel.password2) {
|
||||
$scope.registerError = "Passwords do not match";
|
||||
return;
|
||||
}
|
||||
|
||||
$http.post('/api/register/user', $scope.loginModel).then(function() {
|
||||
$scope.emitAppEvent('logged-in');
|
||||
$location.path('/');
|
||||
$location.path('/login');
|
||||
}, function(err) {
|
||||
if (err.status === 401) {
|
||||
$scope.registerError = "Username or password is incorrect";
|
||||
}
|
||||
else {
|
||||
$scope.loginError = "Unexpected error";
|
||||
}
|
||||
$scope.registerError = "Unexpected error: " + err;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user