更新登录

parent 10bd4bb4
...@@ -7,7 +7,7 @@ use Illuminate\Http\Request; ...@@ -7,7 +7,7 @@ use Illuminate\Http\Request;
use App\Http\Requests; use App\Http\Requests;
use RedisDB; use RedisDB;
class LoginController extends Controller class ApiController extends Controller
{ {
public function Entrance(Request $request, $id ){ public function Entrance(Request $request, $id ){
$this->$id($request, $id); $this->$id($request, $id);
......
...@@ -11,23 +11,10 @@ use RedisDB; ...@@ -11,23 +11,10 @@ use RedisDB;
class WebController extends Controller class WebController extends Controller
{ {
public function info(Request $request,$id=''){ public function info(Request $request,$id=''){
// $uri = '/' . $request->path();
// $data = [
// 'header' => $request->user->header,
// ];
$data =[] ; $data =[] ;
if(empty($id)){ if(empty($id)){
return view('pc.orderList'); return view('pc.orderList');
} }
// $perm=perm($request->user->userId,$id);
// if($perm!==true){
// $data=[
// 'errcode'=>403,
// 'errinfo'=>'鉴权失败',
// 'url'=>Config('website.GoUrl')
// ];
// return view('errors.error', $data);
// }
return $this->$id($request,$data,$id); return $this->$id($request,$data,$id);
} }
...@@ -48,5 +35,4 @@ class WebController extends Controller ...@@ -48,5 +35,4 @@ class WebController extends Controller
return view('pc.orderList',$data); return view('pc.orderList',$data);
} }
} }
...@@ -29,7 +29,6 @@ class Kernel extends HttpKernel ...@@ -29,7 +29,6 @@ class Kernel extends HttpKernel
], ],
'api' => [ 'api' => [
], ],
'webapi'=>[ 'webapi'=>[
......
...@@ -7,25 +7,33 @@ use App\Http\Output; ...@@ -7,25 +7,33 @@ use App\Http\Output;
use App\Http\Error; use App\Http\Error;
use Config; use Config;
use DB; use DB;
use Illuminate\Support\Facades\Redis;
class CheckLogin class CheckLogin
{ {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
$accountId = $request->cookie('yunxin_account_id'); $yunxin_token = $request->cookie('yunxin_token');
$loginKey = $request->cookie('yunxin_login_key'); $userInfo = Redis::get('yunxin_login_'.$yunxin_token);
$isApi = false;
$nowUrl = $request->url();
$pos = strpos($request->path(), 'api/'); $pos = strpos($request->path(), 'api/');
$isApi = false;
if ($pos === 0) $isApi = true;
// $user->code=DB::connection()->table('lie_intracode')->where('admin_id',$user->userId)->select('code_id')->first(); if (empty($yunxin_token) || empty($userInfo) ){ //没有登录跳到登录页
// $request->user = $user; if (strpos($nowUrl,'/api/ApiLogin') == false && $isApi){
return [-1,'请登录'];
}
if (strpos($nowUrl,'/web/login') == false && !$isApi){
return redirect('/web/login' );
}
}
$userInfoArr = json_decode($userInfo,true);
$request->account_id = $userInfoArr['account_id'];
$request->supplier_id = $userInfoArr['supplier_id'];
$request->supplier_name = $userInfoArr['supplier_name'];
$request->role_id = $userInfoArr['role_id'];
return $next($request); return $next($request);
} }
......
...@@ -1021,9 +1021,9 @@ function SelectDb($db,$sql){ ...@@ -1021,9 +1021,9 @@ function SelectDb($db,$sql){
} }
function Export($errcode=0,$errmsg='成功',$data=''){ function Export($errcode=0,$errmsg='成功',$data=''){
if(is_array($errcode)){ if(is_array($errcode)){
echo json_encode(['errcode'=>$errcode[0],'errmsg'=>$errcode[1],'data'=>!empty(@$errcode[2])?@$errcode[2]:''], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); echo json_encode(['code'=>$errcode[0],'msg'=>$errcode[1],'data'=>!empty(@$errcode[2])?@$errcode[2]:''], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
}else{ }else{
echo json_encode(['errcode'=>$errcode,'errmsg'=>$errmsg,'data'=>$data], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); echo json_encode(['code'=>$errcode,'msg'=>$errmsg,'data'=>$data], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
} }
exit(); exit();
} }
...@@ -1048,7 +1048,7 @@ function utf8JsonEncode($arr){ ...@@ -1048,7 +1048,7 @@ function utf8JsonEncode($arr){
*/ */
function createPassword($passwd) function createPassword($passwd)
{ {
return hash('sha256', md5($passwd) . config("website.supplier_login_slat")); return hash('sha256', md5($passwd) . config("fixed.supplier_login_slat"));
} }
/* /*
*创建随机密钥 *创建随机密钥
...@@ -1056,4 +1056,57 @@ function createPassword($passwd) ...@@ -1056,4 +1056,57 @@ function createPassword($passwd)
function createSlat($length = 32) function createSlat($length = 32)
{ {
return base64_encode(openssl_random_pseudo_bytes($length)); return base64_encode(openssl_random_pseudo_bytes($length));
}
/**
* 第三方仓库加密
* $info 需要加密的数据 array
* $appid 分配给第三方仓库的appid
*/
function ExcessEncryption($info,$appid,$key){
if(empty($info)) return false;
$data['data']=Encryption(json_encode($info),$key);
$data['timestamp']=time();
$data['appid']=$appid;
$data['token']=md5($data['data'].$data['timestamp'].$key.$appid);
return $data;
}
/**
* 解密第三方仓库加密
*/
function ExcessDecrypt($data,$key){
if(time()-(int)$data['timestamp']>10) return [10000,'时间戳验证超时,请更新当前客户端时间'];
$Redis=new \App\Model\RedisModel();
if($data['token']!==md5($data['data'].$data['timestamp'].$key.$data['appid'])) return [10001,'Token验证失败'];
$info=json_decode(Deciphering($data['data'],$key),true);
if(empty($info)) return [10004,'解密失败'];
if($Redis->get($data['token'])) return [10003,'不允许重复提交'];
$Redis->set($data['token'],true);
$Redis->expire($data['token'],10);
return [0,'success',$info];
}
/**
* 加密明文
* $data 需要加密的明文 string
* $key 加密用的秘钥 string 32位
*/
function Encryption($data,$key){
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext =base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_ECB, $iv));
return $crypttext;
}
/**
* 解密
* $plain_text 需要解密的密文 string
* $key 解密秘钥 string 32位
*/
function Deciphering($plain_text,$key){
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decoded=mcrypt_decrypt(MCRYPT_RIJNDAEL_256,$key,base64_decode($plain_text),MCRYPT_MODE_ECB,$iv);
return trim($decoded); // trim删除末尾增加的NULL字节
} }
\ No newline at end of file
<?php <?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['middleware' => 'web'], function () { Route::group(['middleware' => 'web'], function () {
Route::get('/', 'WebController@info'); Route::get('/', 'WebController@info');
Route::match(['get', 'post'],'/web/{key}', 'WebController@info'); Route::match(['get', 'post'],'/web/{key}', 'WebController@info');
Route::match(['get', 'post'],'/api/{key}', 'ApiController@Entrance'); Route::match(['get', 'post'],'/api/{key}', 'ApiController@Entrance');
Route::match(['get', 'post'],'/helper/{key}', 'HelperController@Entrance'); Route::match(['get', 'post'],'/helper/{key}', 'HelperController@Entrance');
Route::match(['get', 'post'],'/hd/{key}', 'HandleController@Entrance'); Route::match(['get', 'post'],'/hd/{key}', 'HandleController@Entrance');
Route::get('/pushAmq', 'QueuedController@pushAmq');
Route::get('/pullAmq', 'QueuedController@pullAmq');
});
Route::group(['middleware' => 'webapi'], function () {
Route::match(['get', 'post'],'/WebApi/{key}', 'WebApiController@Entrance');
}); });
Route::group(['middleware' => 'WmsApi'], function () {
Route::match(['get', 'post'],'/wmsapi/{key}','WmsApiController@Entrance');
});
\ No newline at end of file
...@@ -26,9 +26,9 @@ class SupplierAccountModel extends Model ...@@ -26,9 +26,9 @@ class SupplierAccountModel extends Model
$password = Request::input('password'); $password = Request::input('password');
$code= Request::input('code');//验证码 $code= Request::input('code');//验证码
if ($_SESSION['yunxin_captcha'] != $code) { // if ($_SESSION['yunxin_captcha'] != $code) {
return [1001,'验证码不正确']; // return [1001,'验证码不正确'];
} // }
$account = $this->where("mobile",$mobile)->first(); $account = $this->where("mobile",$mobile)->first();
if (!$account){ if (!$account){
return [1002,'不存在此账号']; return [1002,'不存在此账号'];
...@@ -37,38 +37,42 @@ class SupplierAccountModel extends Model ...@@ -37,38 +37,42 @@ class SupplierAccountModel extends Model
return [1003,'密码错误']; return [1003,'密码错误'];
} }
//用户详情 //用户详情
$supplierInfo = DB::connetion("web")->table("supplier_channel")->where("supplier_id",$account['supplier_id'])->first(); $supplierInfo = DB::connection("web")->table("supplier_channel")->where("supplier_id",$account['supplier_id'])->first();
//用户角色 //用户角色
$roleInfo = DB::connetion("yunxin")->table("auth_role_access")->where("account_id",$account['id'])->first(); $yunxinCon = DB::connection("yunxin");
$roleInfo = $yunxinCon->table("auth_role_access")->where("account_id",$account['id'])->first();
$info = [ $info = [
'supplier_id'=>$account['supplier_id'], 'supplier_id'=>$account['supplier_id'],
'supplier_name'=>$supplierInfo['supplier_name'], 'supplier_name'=>$supplierInfo['supplier_name'],
'account_id'=>$account['account_id'], 'account_id'=>$account['id'],
'role_id'=>$roleInfo['role_id'], 'role_id'=>$roleInfo['role_id'],
]; ];
try{ try{
$con = DB::connection('web'); $con = DB::connection('web');
$con->beginTransaction(); $con->beginTransaction();
#登录信息写入缓存 #登录信息写入缓存
$key = md5('supplier_login_'.md5($mobile.$code.time())); $key = md5($mobile.$code.time());
$expire = 7200;//过期两个小时 $expire = 7200;//过期两个小时
Redis::setex($key, $expire, self::encode($info)); $res = Redis::setex('yunxin_login_'.$key, $expire, utf8JsonEncode($info));
$_COOKIE['yunxin_key'] = $key; if ($res != 'OK'){
throw new Exception('写入缓存失败',1004);
}
#记录登录日志 #记录登录日志
$log['account_id'] = $account['id']; $log['account_id'] = $account['id'];
$log['action_ip'] = $mobile; $log['action_ip'] = $mobile;
$log['create_time'] = time(); $log['create_time'] = time();
$log['remark'] = utf8JsonEncode($info); $log['remark'] = utf8JsonEncode($info);
$logid = $this->insertGetId($log); $logid = $yunxinCon->table("log_login")->insertGetId($log);
if (!$logid){ if (!$logid){
throw new Exception('插入日志失败',1004); throw new Exception('插入日志失败',1005);
} }
$con->commit(); $con->commit();
return ['0','登录成功,登录token:'.$key]; return ['0','登录成功',$key];
}catch (\Exception $e) { }catch (\Exception $e) {
$con->rollBack(); $con->rollBack();
return [$e->getCode(),$e->getMessage()]; return [$e->getCode(),$e->getMessage()];
......
...@@ -141,6 +141,18 @@ return [ ...@@ -141,6 +141,18 @@ return [
'prefix' => 'lie_', 'prefix' => 'lie_',
'strict' => false, 'strict' => false,
], ],
'yunxin' => [
'driver' => 'mysql',
'host' => env('DB_HOST_YUNXIN', ''),
'database' => env('DB_DATABASE_YUNXIN', ''),
'username' => env('DB_USERNAME_YUNXIN', ''),
'password' => env('DB_PASSWORD_YUNXIN', ''),
'port' => env('DB_PORT_YUNXIN', 3306),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
'strict' => false,
],
'rabbitmq' => [ 'rabbitmq' => [
'driver' => 'rabbitmq', 'driver' => 'rabbitmq',
'host' => env('RABBITMQ_HOST', '127.0.0.1'), 'host' => env('RABBITMQ_HOST', '127.0.0.1'),
......
<?php <?php
#与线上环境同步
return [ return [
//密码加盐 //密码加盐
'supplier_login_slat'=>'N<*^&9781UO0&*<>~,.laGTVC', 'supplier_login_slat'=>'N<*^&9781UO0&*<>~,.laGTVC',
......
<?php <?php
#不与线上环境同步
return [ return [
'admin' => ['yyc@ichunt.com'],
'login' => [
'login' => 'http://' . env('LOGIN_DOMAIN', '') . '/login',
'logout'=> 'http://' . env('LOGIN_DOMAIN', '') . '/logout',
'check' => 'http://' . env('LOGIN_DOMAIN', '') . '/api/checklogin',
'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search',
'dashboard'=>'http://'.env('LOGIN_DOMAIN', '') . '/dashboard',
],
'data' => env('DATA_DOMAIN', 'pur.liexin.com'),
"domain" => "liexin.com",
'http'=>'http://',
'mongodb'=>env('MONGO_HOST', ''),//mongo连接信息
'PermId'=>22,//权限配置ID "URL_YUNXIN" => "yunxin.liexin.com",
'GoUrl'=>'http://perm.liexin.net',//权限系统地址 "URL_FINANCE" => "finance.liexin.com",
'PermUrl'=>'http://perm.liexin.net/api/check',//权限地址 "URL_FOOTSTONE" => "foostone.liexin.com",
"URL_PUR" => "pur.liexin.com",
'MenuId'=>12,//菜单配置ID "domain" => "liexin.com", //根域名
'AdminId'=>array(//管理员ID(不用验证权限)
1354,1000
),
'UploadUrl'=>'http://api.liexin.com/oss/upload',//上传图片接口地址 'UploadUrl'=>'http://api.liexin.com/oss/upload',//上传图片接口地址
'UploadKey'=>'fh6y5t4rr351d2c3bryi', 'UploadKey'=>'fh6y5t4rr351d2c3bryi',
'PurchaseID'=>90,//采购部顶级部门ID
'FS_SELF_SKU_URL'=>'http://footstone.liexin.net/AuthApi/WebApiObtainSkuList',//获取sku列表
'MD5KEY'=>'LX@ichunt.com82560956-0755', 'MD5KEY'=>'LX@ichunt.com82560956-0755',
'SelfSupplierID'=>10000,
'FS_API_Url'=>'http://footstone.liexin.com/AuthApi/',
'HL_LOGIN_URL'=>'http://192.168.1.235:6888/ormrpc/services/EASLogin?wsdl',
'HL_URL'=>'http://192.168.1.235:6888/ormrpc/services/WSIchuntjKFacade?wsdl',
'HL_CONFIG'=>array(
"ck", "123456", "eas", "ICHUNT", "L2", 1, "BaseDB"
),
'serviceUrl'=>'http://192.168.1.100:55533/transpond',
'http'=>'http://',
'FinanceUrl'=>'http://finance.liexin.com',
'WmsServiceUrl'=>'http://196.168.1.100:55533/',
//财务系统生成预付款单接口
'api_to_finance' => 'http://finance.liexin.com/webapi/CreatePaymentAccount',
'api_get_finance_id' => 'http://finance.liexin.com/webapi/pushPurchaseForGeneratingPaymentOrders',
]; ];
/**
* Created by hcy on 2019/2/19.
*/
var _URL_ = "http://yunxin.liexin.com";
function login() {
$.ajax({
url:_URL_+'/api/ApiLogin',
type:'post',
data:{
'mobile':$("#mobile").val(),
'password':$.md5($("#password").val()),
'code': $("#code").val()
},
async: false,
dataType:'json',
timeout:10000,
success:function (resp) {
if(resp.code > 0 ){
alert(resp.msg)
}else{
setCookie('yunxin_token',resp.data)
window.location.href = "/web/orderList"
}
}
})
}
function setCookie(name,value){
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*30);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name){
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
/*
* jQuery MD5 Plugin 1.2.1
* https://github.com/blueimp/jQuery-MD5
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://creativecommons.org/licenses/MIT/
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*jslint bitwise: true */
/*global unescape, jQuery */
(function ($) {
'use strict';
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bit_rol(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5_cmn(q, a, b, x, s, t) {
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
}
function md5_ff(a, b, c, d, x, s, t) {
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t) {
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t) {
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t) {
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length.
*/
function binl_md5(x, len) {
/* append padding */
x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var i, olda, oldb, oldc, oldd,
a = 1732584193,
b = -271733879,
c = -1732584194,
d = 271733878;
for (i = 0; i < x.length; i += 16) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = md5_ff(a, b, c, d, x[i], 7, -680876936);
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i], 20, -373897302);
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = md5_hh(d, a, b, c, x[i], 11, -358537222);
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i], 6, -198630844);
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return [a, b, c, d];
}
/*
* Convert an array of little-endian words to a string
*/
function binl2rstr(input) {
var i,
output = '';
for (i = 0; i < input.length * 32; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
}
return output;
}
/*
* Convert a raw string to an array of little-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binl(input) {
var i,
output = [];
output[(input.length >> 2) - 1] = undefined;
for (i = 0; i < output.length; i += 1) {
output[i] = 0;
}
for (i = 0; i < input.length * 8; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
}
return output;
}
/*
* Calculate the MD5 of a raw string
*/
function rstr_md5(s) {
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
}
/*
* Calculate the HMAC-MD5, of a key and some data (raw strings)
*/
function rstr_hmac_md5(key, data) {
var i,
bkey = rstr2binl(key),
ipad = [],
opad = [],
hash;
ipad[15] = opad[15] = undefined;
if (bkey.length > 16) {
bkey = binl_md5(bkey, key.length * 8);
}
for (i = 0; i < 16; i += 1) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex(input) {
var hex_tab = '0123456789abcdef',
output = '',
x,
i;
for (i = 0; i < input.length; i += 1) {
x = input.charCodeAt(i);
output += hex_tab.charAt((x >>> 4) & 0x0F) +
hex_tab.charAt(x & 0x0F);
}
return output;
}
/*
* Encode a string as utf-8
*/
function str2rstr_utf8(input) {
return unescape(encodeURIComponent(input));
}
/*
* Take string arguments and return either raw or hex encoded strings
*/
function raw_md5(s) {
return rstr_md5(str2rstr_utf8(s));
}
function hex_md5(s) {
return rstr2hex(raw_md5(s));
}
function raw_hmac_md5(k, d) {
return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));
}
function hex_hmac_md5(k, d) {
return rstr2hex(raw_hmac_md5(k, d));
}
$.md5 = function (string, key, raw) {
if (!key) {
if (!raw) {
return hex_md5(string);
} else {
return raw_md5(string);
}
}
if (!raw) {
return hex_hmac_md5(key, string);
} else {
return raw_hmac_md5(key, string);
}
};
}(typeof jQuery === 'function' ? jQuery : this));
\ No newline at end of file
...@@ -37,18 +37,18 @@ ...@@ -37,18 +37,18 @@
<i class="icn i-1"></i> <i class="icn i-1"></i>
<b class="lineBlock emptys"></b> <b class="lineBlock emptys"></b>
</div> </div>
<input type="text" placeholder="请输入手机号"> <input type="text" id="mobile" placeholder="请输入手机号">
</div> </div>
<div class="inp-wrap"> <div class="inp-wrap">
<div class="arr"> <div class="arr">
<i class="icn i-2"></i> <i class="icn i-2"></i>
<b class="lineBlock emptys"></b> <b class="lineBlock emptys"></b>
</div> </div>
<input type="text" placeholder="请输入登录密码"> <input type="text" id="password" placeholder="请输入登录密码">
</div> </div>
<div class="code clr"> <div class="code clr">
<div class="code-inp fl"> <div class="code-inp fl">
<input type="text" placeholder="请输入验证码"> <input type="text" id="code" placeholder="请输入验证码">
</div> </div>
<div class="code-img fr"> <div class="code-img fr">
<img src="/helper/captcha" alt=""> <img src="/helper/captcha" alt="">
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
<a href="#" class="t2 fr">忘记密码?</a> <a href="#" class="t2 fr">忘记密码?</a>
<div class="error"> 帐号或密码错误,请重新输入!</div> <div class="error"> 帐号或密码错误,请重新输入!</div>
</div> </div>
<div class="btn"> <div class="btn" >
<a href="javascript:;">登录</a> <a href="javascript:;" onclick="login()">登录</a>
</div> </div>
</div> </div>
</div> </div>
...@@ -121,5 +121,7 @@ ...@@ -121,5 +121,7 @@
<!--footer end--> <!--footer end-->
<script type="text/javascript" src="/pc/js/jquery.min.js"></script> <script type="text/javascript" src="/pc/js/jquery.min.js"></script>
<script type="text/javascript" src="/pc/js/layui/layui.js"></script> <script type="text/javascript" src="/pc/js/layui/layui.js"></script>
<script type="text/javascript" src="/pc/js/md5/jquery.md5.js"></script>
<script type="text/javascript" src="/pc/js/controller/ControllerLogin.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
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 sign in to comment