增加登陆按回车键

This commit is contained in:
luchenqun 2017-01-18 11:13:16 +08:00
parent f96b3772e7
commit 91feb12946
4 changed files with 12 additions and 5 deletions

2
app.js
View File

@ -30,7 +30,7 @@ app.use(session({
saveUninitialized: true, //添加这行
secret: 'ILoveYiJia', // 建议使用 128 个字符的随机字符串
cookie: {
maxAge: 3600000 * 24 * 30
maxAge: 2592000000,
}
}));

View File

@ -1,8 +1,8 @@
var mysql = require('mysql');
var client = mysql.createConnection({
host: '127.0.0.1'|| '172.24.13.5',
user: 'lcq'|| 'root',
password: 'fendoubuxi596320'|| 'root123',
host: '127.0.0.1',
user: 'lcq',
password: 'fendoubuxi596320',
database: 'mybookmarks',
multipleStatements: true,
port: 3306

View File

@ -11,6 +11,13 @@ app.controller('loginCtr', ['$scope', '$filter', '$state', '$cookieStore', 'book
$scope.showErr = false;
$scope.errInfo = '';
$scope.myKeyup = function(e) {
var keycode = window.event ? e.keyCode : e.which;
if (keycode == 13) {
$scope.login();
}
};
$scope.login = function() {
var autoLogin = $('.ui.checkbox.js-auto-login').checkbox('is checked');
if (!$scope.username || !$scope.password) {

View File

@ -14,7 +14,7 @@
<div class="required field">
<label>密码</label>
<div class="ui icon input">
<input type="password" ng-model="password">
<input type="password" ng-model="password" ng-keyup="myKeyup($event)">
<i class="lock icon"></i>
</div>
</div>