Skip to content

Commit e40b462

Browse files
committed
began work on reset password view, and angular controller
1 parent 89418a1 commit e40b462

File tree

6 files changed

+84
-2
lines changed

6 files changed

+84
-2
lines changed

public/app/controllers/all.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ define([
66
'./inspectCtrl',
77
'./jsonEditorCtrl',
88
'./loginCtrl',
9+
'./resetPasswordCtrl',
910
'./sidemenuCtrl',
1011
'./errorCtrl',
1112
], function () {});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
define([
2+
'angular',
3+
'app',
4+
'lodash'
5+
],
6+
function (angular, app, _) {
7+
'use strict';
8+
9+
var module = angular.module('grafana.controllers');
10+
11+
module.controller('ResetPasswordCtrl', function($scope, contextSrv, backendSrv) {
12+
13+
contextSrv.sidemenu = false;
14+
$scope.sendMode = true;
15+
$scope.formModel = {};
16+
17+
$scope.sendResetEmail = function() {
18+
if (!$scope.loginForm.$valid) {
19+
return;
20+
}
21+
22+
backendSrv.post('/api/user/password/send-reset-email', $scope.formModel).then(function() {
23+
});
24+
};
25+
26+
});
27+
28+
});

public/app/partials/login.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@
9191
</div>
9292
</div>
9393

94-
<div class="row" style="margin-top: 100px">
94+
<div class="row" style="margin-top: 40px">
95+
<div class="text-center">
96+
<a href="reset-password/send">
97+
Forgot your password?
98+
</a>
99+
</div>
100+
</div>
101+
102+
<div class="row" style="margin-top: 50px">
95103
<div class="version-footer text-center small">
96104
Grafana version: {{buildInfo.version}}, commit: {{buildInfo.commit}},
97105
build date: {{buildInfo.buildstamp | date: 'yyyy-MM-dd HH:mm:ss' }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<div class="container">
2+
3+
<div class="login-box">
4+
5+
<div class="login-box-logo">
6+
<img src="img/logo_transparent_200x75.png">
7+
</div>
8+
9+
<div class="login-inner-box">
10+
<div class="login-tab-header">
11+
<button class="btn-login-tab" class="active">
12+
Reset password
13+
</button>
14+
</div>
15+
16+
<form name="sendResetForm" class="login-form">
17+
<div class="tight-form" ng-if="sendMode">
18+
<ul class="tight-form-list">
19+
<li class="tight-form-item" style="width: 78px">
20+
<strong>User</strong>
21+
</li>
22+
<li>
23+
<input type="text" name="username" class="tight-form-input last" required ng-model='formModel.userOrEmail' placeholder="email or username" style="width: 253px">
24+
</li>
25+
</ul>
26+
<div class="clearfix"></div>
27+
</div>
28+
29+
<div class="login-submit-button-row">
30+
<button type="submit" class="btn" ng-click="sendResetEmail();" ng-class="{'btn-inverse': !sendResetForm.$valid, 'btn-primary': sendResetForm.$valid}">
31+
Send reset instructions
32+
</button>
33+
</div>
34+
</form>
35+
36+
<div class="clearfix"></div>
37+
</div>
38+
39+
</div>
40+
</div>
41+

public/app/routes/all.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ define([
9797
templateUrl: 'app/partials/login.html',
9898
controller : 'LoginCtrl',
9999
})
100+
.when('/reset-password/send', {
101+
templateUrl: 'app/partials/reset_password.html',
102+
controller : 'ResetPasswordCtrl',
103+
})
100104
.otherwise({
101105
templateUrl: 'app/partials/error.html',
102106
controller: 'ErrorCtrl'

public/css/less/login.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
padding: 9px 7px;
7575
font-size: 14px;
7676
font-weight: bold;
77-
width: 150px;
77+
min-width: 150px;
7878
display: inline-block;
7979
border: 1px solid lighten(@btnInverseBackground, 10%);
8080
}

0 commit comments

Comments
 (0)