Password: Remove PasswordStrength (#17750)

* Closes #17748

* Remove remaining occurences

* And the last one
This commit is contained in:
Tobias Skarhed 2019-06-25 13:56:35 +02:00 committed by Torkel Ödegaard
parent e83953f24e
commit 0904607eda
7 changed files with 0 additions and 94 deletions

View File

@ -1,7 +1,6 @@
import { react2AngularDirective } from 'app/core/utils/react2angular';
import { QueryEditor as StackdriverQueryEditor } from 'app/plugins/datasource/stackdriver/components/QueryEditor';
import { AnnotationQueryEditor as StackdriverAnnotationQueryEditor } from 'app/plugins/datasource/stackdriver/components/AnnotationQueryEditor';
import { PasswordStrength } from './components/PasswordStrength';
import PageHeader from './components/PageHeader/PageHeader';
import EmptyListCTA from './components/EmptyListCTA/EmptyListCTA';
import { TagFilter } from './components/TagFilter/TagFilter';
@ -14,7 +13,6 @@ import { SearchField } from './components/search/SearchField';
import { GraphContextMenu } from 'app/plugins/panel/graph/GraphContextMenu';
export function registerAngularDirectives() {
react2AngularDirective('passwordStrength', PasswordStrength, ['password']);
react2AngularDirective('sidemenu', SideMenu, []);
react2AngularDirective('functionEditor', FunctionEditor, ['func', 'onRemove', 'onMoveLeft', 'onMoveRight']);
react2AngularDirective('appNotificationsList', AppNotificationList, []);

View File

@ -1,37 +0,0 @@
import React from 'react';
export interface Props {
password: string;
}
export class PasswordStrength extends React.Component<Props, any> {
constructor(props: Props) {
super(props);
}
render() {
const { password } = this.props;
let strengthText = 'strength: strong like a bull.';
let strengthClass = 'password-strength-good';
if (!password) {
return null;
}
if (password.length <= 8) {
strengthText = 'strength: you can do better.';
strengthClass = 'password-strength-ok';
}
if (password.length < 4) {
strengthText = 'strength: weak sauce.';
strengthClass = 'password-strength-bad';
}
return (
<div className={`password-strength small ${strengthClass}`}>
<em>{strengthText}</em>
</div>
);
}
}

View File

@ -1,21 +0,0 @@
import React from 'react';
import { shallow } from 'enzyme';
import { PasswordStrength } from '../components/PasswordStrength';
describe('PasswordStrength', () => {
it('should have class bad if length below 4', () => {
const wrapper = shallow(<PasswordStrength password="asd" />);
expect(wrapper.find('.password-strength-bad')).toHaveLength(1);
});
it('should have class ok if length below 8', () => {
const wrapper = shallow(<PasswordStrength password="asdasd" />);
expect(wrapper.find('.password-strength-ok')).toHaveLength(1);
});
it('should have class good if length above 8', () => {
const wrapper = shallow(<PasswordStrength password="asdaasdda" />);
expect(wrapper.find('.password-strength-good')).toHaveLength(1);
});
});

View File

@ -25,10 +25,6 @@
<input type="password" name="password" class="gf-form-input max-width-21" required ng-model="formModel.password" id="inputPassword" placeholder="password">
</div>
<div style="margin-left: 7.5rem; width: 254px;">
<password-strength password="formModel.password"></password-strength>
</div>
<div class="gf-form-button-row">
<button type="submit" class="btn btn-primary" ng-click="submit();" ng-disable="!inviteForm.$valid">
Sign Up

View File

@ -32,10 +32,6 @@
<input type="password" class="gf-form-input max-width-14" required ng-model="formModel.password" id="inputPassword" placeholder="password" autocomplete="off">
</div>
<div class="signup__password-strength">
<password-strength password="formModel.password"></password-strength>
</div>
<div class="gf-form-button-row p-t-3">
<button type="submit" class="btn btn-primary" ng-click="ctrl.submit();" ng-disabled="!signUpForm.$valid">
Sign Up

View File

@ -190,26 +190,6 @@ select:-webkit-autofill:focus {
background-color: $btn-semi-transparent;
}
.password-strength {
display: block;
width: 15%;
overflow: visible;
white-space: nowrap;
padding-top: 3px;
color: darken($text-color, 20%);
border-top: 3px solid $red-base;
&.password-strength-ok {
width: 40%;
border-top: 3px solid lighten($yellow, 10%);
}
&.password-strength-good {
width: 100%;
border-top: 3px solid lighten($green-base, 10%);
}
}
.login-submit-button-row {
text-align: center;
margin-top: 30px;

View File

@ -14,9 +14,3 @@
padding: 80px 0;
}
}
.signup__password-strength {
position: absolute;
margin-left: 122px;
width: 192px;
}