Commit 0904607e by Tobias Skarhed Committed by Torkel Ödegaard

Password: Remove PasswordStrength (#17750)

* Closes #17748

* Remove remaining occurences

* And the last one
parent e83953f2
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, []);
......
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>
);
}
}
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);
});
});
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -14,9 +14,3 @@
padding: 80px 0;
}
}
.signup__password-strength {
position: absolute;
margin-left: 122px;
width: 192px;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment