美文网首页
2018-10-24

2018-10-24

作者: 恋兮兮 | 来源:发表于2018-10-24 10:02 被阅读0次
    owner.login = function(loginInfo, callback) {callback = callback || $.noop;loginInfo = loginInfo || {};
            loginInfo.account = loginInfo.account || '';
            loginInfo.password = loginInfo.password || '';
            if (loginInfo.account.length < 5) {
                return callback('账号最短为 5 个字符');
            }
            if (loginInfo.password.length < 6) {
                return callback('密码最短为 6 个字符');
            }
            var users = JSON.parse(localStorage.getItem('$users') || '[]');
            var authed = users.some(function(user) {
                return loginInfo.account == user.account && loginInfo.password == user.password;
            });
            if (authed) {
                return owner.createState(loginInfo.account, callback);
            } else {
                return callback('用户名或密码错误');
            }
        };
    owner.login = function(loginInfo, callback) {callback = callback || $.noop;loginInfo = loginInfo || {};
            loginInfo.account = loginInfo.account || '';
            loginInfo.password = loginInfo.password || '';
            if (loginInfo.account.length < 5) {
                return callback('账号最短为 5 个字符');
            }
            if (loginInfo.password.length < 6) {
                return callback('密码最短为 6 个字符');
            }
            var users = JSON.parse(localStorage.getItem('$users') || '[]');
            var authed = users.some(function(user) {
                return loginInfo.account == user.account && loginInfo.password == user.password;
            });
            if (authed) {
                return owner.createState(loginInfo.account, callback);
            } else {
                return callback('用户名或密码错误');
            }
        };
    owner.login = function(loginInfo, callback) {callback = callback || $.noop;loginInfo = loginInfo || {};
            loginInfo.account = loginInfo.account || '';
            loginInfo.password = loginInfo.password || '';
            if (loginInfo.account.length < 5) {
                return callback('账号最短为 5 个字符');
            }
            if (loginInfo.password.length < 6) {
                return callback('密码最短为 6 个字符');
            }
            var users = JSON.parse(localStorage.getItem('$users') || '[]');
            var authed = users.some(function(user) {
                return loginInfo.account == user.account && loginInfo.password == user.password;
            });
            if (authed) {
                return owner.createState(loginInfo.account, callback);
            } else {
                return callback('用户名或密码错误');
            }
        };
    

    相关文章

      网友评论

          本文标题:2018-10-24

          本文链接:https://www.haomeiwen.com/subject/qrrttqtx.html