Repository: lens Updated Branches: refs/heads/master 12b95da07 -> 2ebbf455f
LENS-1193: It should be possible to disable password field in lens ui Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/2ebbf455 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/2ebbf455 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/2ebbf455 Branch: refs/heads/master Commit: 2ebbf455f8a93e1141bec0cca21b307a7ed45bbc Parents: 12b95da Author: Rajat Khandelwal <[email protected]> Authored: Fri Jun 17 19:50:38 2016 +0530 Committer: Rajat Khandelwal <[email protected]> Committed: Fri Jun 17 19:50:38 2016 +0530 ---------------------------------------------------------------------- lens-ui/app/adapters/AuthenticationAdapter.js | 2 +- lens-ui/app/components/DatabaseComponent.js | 4 ++-- lens-ui/app/components/LoginComponent.js | 8 +++++--- lens-ui/config.json | 3 ++- lens-ui/server.js | 3 +-- 5 files changed, 11 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/2ebbf455/lens-ui/app/adapters/AuthenticationAdapter.js ---------------------------------------------------------------------- diff --git a/lens-ui/app/adapters/AuthenticationAdapter.js b/lens-ui/app/adapters/AuthenticationAdapter.js index 26a35f3..15c196b 100644 --- a/lens-ui/app/adapters/AuthenticationAdapter.js +++ b/lens-ui/app/adapters/AuthenticationAdapter.js @@ -43,7 +43,7 @@ let AuthenticationAdapter = { // preparing data as API accepts multipart/form-data :( var formData = new FormData(); formData.append('username', email); - formData.append('password', password); + formData.append('password', password || ""); formData.append('sessionconf', sessionconf); return BaseAdapter.post(authUrl, formData, { http://git-wip-us.apache.org/repos/asf/lens/blob/2ebbf455/lens-ui/app/components/DatabaseComponent.js ---------------------------------------------------------------------- diff --git a/lens-ui/app/components/DatabaseComponent.js b/lens-ui/app/components/DatabaseComponent.js index e99be00..15a4e46 100644 --- a/lens-ui/app/components/DatabaseComponent.js +++ b/lens-ui/app/components/DatabaseComponent.js @@ -75,10 +75,10 @@ class DatabaseComponent extends React.Component { databaseComponent = (<div> <label className='control-label' id='db'>Select a Database</label> - <select className='form-control' id='db' onChange={this.setDatabase}> + <select className='form-control' id='db' onChange={this.setDatabase} value={this.state.selectedDatabase} > <option value=''>Select</option> {this.state.databases.map(database => { - return <option key={database} value={database} selected={database == this.state.selectedDatabase}>{database}</option>; + return <option key={database} value={database}>{database}</option>; })} </select> </div>); http://git-wip-us.apache.org/repos/asf/lens/blob/2ebbf455/lens-ui/app/components/LoginComponent.js ---------------------------------------------------------------------- diff --git a/lens-ui/app/components/LoginComponent.js b/lens-ui/app/components/LoginComponent.js index c0840e1..23b3bb9 100644 --- a/lens-ui/app/components/LoginComponent.js +++ b/lens-ui/app/components/LoginComponent.js @@ -20,7 +20,7 @@ import React from 'react'; import UserStore from '../stores/UserStore'; import LoginActions from '../actions/LoginActions'; - +import Config from 'config.json' import '../styles/css/login.css'; var error = false; @@ -31,7 +31,8 @@ class Login extends React.Component { this.handleSubmit = this.handleSubmit.bind(this); this._onChange = this._onChange.bind(this); this.state = { - error: UserStore.isUserLoggedIn() + error: UserStore.isUserLoggedIn(), + password_required: Config.password_required }; } @@ -61,7 +62,8 @@ class Login extends React.Component { placeholder='Email address' required autoFocus/> <label htmlFor='inputPassword' className='sr-only'>Password</label> <input ref='pass' type='password' id='inputPassword' - className='form-control' placeholder='Password' required/> + className='form-control' placeholder='Password' + required={this.state.password_required} disabled={!this.state.password_required}/> <button className='btn btn-primary btn-block' type='submit'>Sign in</button> {this.state.error && ( http://git-wip-us.apache.org/repos/asf/lens/blob/2ebbf455/lens-ui/config.json ---------------------------------------------------------------------- diff --git a/lens-ui/config.json b/lens-ui/config.json index 3316bf6..bebc7e5 100644 --- a/lens-ui/config.json +++ b/lens-ui/config.json @@ -1,4 +1,5 @@ { "isPersistent": true, - "baseURL": "/serverproxy/" + "baseURL": "/serverproxy/", + "password_required" : true } http://git-wip-us.apache.org/repos/asf/lens/blob/2ebbf455/lens-ui/server.js ---------------------------------------------------------------------- diff --git a/lens-ui/server.js b/lens-ui/server.js index 12b94e7..c8920f3 100644 --- a/lens-ui/server.js +++ b/lens-ui/server.js @@ -47,8 +47,7 @@ app.use(session({ saveUninitialized : true })); -var fs = require('fs') -; +var fs = require('fs'); app.use(express.static(path.resolve(__dirname, 'target', 'assets'))); app.get('/health', function (req, res) {
