company_security.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. @extends('module.layouts.company')
  2. @push('meta')
  3. @endpush
  4. @push('css')
  5. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/common.css') }}"/>
  6. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_user.css')}}"/>
  7. <link rel="stylesheet" type="text/css" href="{{ theme_asset('app/css/company/company_ajax_dialog.css')}}"/>
  8. <style>.td1 a:hover{cursor: pointer} </style>
  9. @endpush
  10. @push('js')
  11. <script type="text/javascript" src="{{ theme_asset('app/js/company/jquery.common.js') }}"></script>
  12. <script type="text/javascript" src="{{ theme_asset('gt/gt.js') }}"></script>
  13. <script type="text/javascript" src="{{ theme_asset('gt/gt.handle.js') }}"></script>
  14. <script>
  15. $(function () {
  16. @if(!empty(session('message')))
  17. disapperTooltip("remind", "{{ session('message') }}");
  18. @endif
  19. });
  20. </script>
  21. @endpush
  22. @section('content')
  23. <div class="user_main">
  24. <div class="mleft">
  25. @include('module.section.company_left')
  26. </div>
  27. <div class="mright">
  28. <div class="user_pagetitle safety_user_pagetitle">
  29. <div class="pat_l">账号安全</div>
  30. <div class="clear"></div>
  31. </div>
  32. <div class="user_tab">
  33. <a href="{{ route('com.security') }}" class="tabli select">账号安全</a>
  34. <a href="{{ route('com.security.loginLog') }}" class="tabli">登录日志</a>
  35. <div class="clear"></div>
  36. </div>
  37. <div class="user_tip w680">
  38. <div class="tiptit">小提示</div>
  39. <div class="tiptxt link_blue">
  40. 手机号、邮箱认证通过后可增强您账号的安全性,也可通过已认证的手机号、邮箱快速登录账号。
  41. </div>
  42. </div>
  43. <div class="safety J_hoverbut link_blue">
  44. <div class="td1">用户名</div>
  45. <div id="J_unameWrap" class="td2">{{ $companyInfo->username }}</div>
  46. <div class="td3">&nbsp;</div>
  47. <div class="td4"><a id="J_edit_uname" href="javascript:;">修改</a></div>
  48. <div class="clear"></div>
  49. </div>
  50. <div class="safety J_hoverbut link_blue">
  51. <div class="td1 t1">密码</div>
  52. <div class="td2">上次登录时间:<span>{{ date('Y-m-d H:i:s', $companyInfo->last_login_time) }}</span></div>
  53. <div class="td3"><a href="{{ route('com.security.loginLog') }}">[查看登录日志]</a></div>
  54. <div class="td4"><a id="J_edit_password" href="javascript:;">修改</a></div>
  55. <div class="clear"></div>
  56. </div>
  57. <div class="safety J_hoverbut link_blue">
  58. <div class="td1 t2">手机</div>
  59. <div id="J_mobileWrap" class="td2">{{ $companyInfo->mobile or "手机未填写"}}<span>(认证后可用于登录账号、找回密码)</span></div>
  60. <div id="J_mobileStatus" class="td3">
  61. @if(!$companyInfo->mobile_audit)<div class="no"> 未认证</div>@else
  62. <div class="yes"> 已认证</div>
  63. @endif
  64. </div>
  65. <input type="hidden" id="J_mobile_verify" value="{{ config('aix.system.site_safety.site_vo_code.captcha_open') }}" />
  66. <div class="td4"><a id="J_auth_mobile" href="javascript:;" data-auth="{{ $companyInfo->mobile_audit }}">@if(!$companyInfo->mobile_audit)立即认证 @else 修改 @endif</a></div>
  67. <div class="clear"></div>
  68. </div>
  69. <div class="safety J_hoverbut link_blue">
  70. <div class="td1 t3">邮箱</div>
  71. <div id="J_emailWrap" class="td2">{{ $companyInfo->email or "Email未填写" }}<span>(认证后用于登录账号、找回密码)</span></div>
  72. <div id="J_emailStatus" class="td3">
  73. @if(!$companyInfo->email_audit)
  74. <div class="no">未认证</div>
  75. @else
  76. <div class="yes"> 已认证</div>
  77. @endif
  78. </div>
  79. <div class="td4">
  80. <a id="J_auth_email" href="javascript:;" data-auth="{{ $companyInfo->email_audit }}">@if(!$companyInfo->email_audit) 立即认证 @else 修改 @endif </a>
  81. </div>
  82. <div class="clear"></div>
  83. </div>
  84. <div class="safety_btit">账号绑定<span>(授权绑定后,可使用第三方账号快速登录)</span></div>
  85. <div class="safety_binding">
  86. @if(config('aix.system.oauth.qq.is_open_qq') == 1)
  87. <div class="td1">
  88. <div class="qq @if($qq) ok @endif">腾讯QQ</div>
  89. @if($qq)
  90. <div class="txt link_blue "><a class="J_unlogin" name="腾讯QQ" url="{{ route('unbindThird',['alias'=>'qq']) }}" href="javascript:;" >解除绑定</a></div>
  91. @else
  92. <div class="txt link_blue"><a id="J_bind_qq">立即绑定</a></div>
  93. @endif
  94. </div>
  95. @endif
  96. @if(config('aix.system.oauth.wechat_open.is_open') == 1)
  97. <div class="td1">
  98. <div class="weixin @if($weixin) ok @endif">微信</div>
  99. @if($weixin)
  100. <div class="txt link_blue "><a class="J_unlogin" name="微信" url="{{ route('unbindThird',['alias'=>'weixin']) }}" href="javascript:;" >解除绑定</a></div>
  101. @else
  102. <div class="txt link_blue"><a id="J_bind_weixin">立即绑定</a></div>
  103. @endif
  104. </div>
  105. @endif
  106. <div class="clear"></div>
  107. </div>
  108. </div>
  109. <div class="clear"></div>
  110. </div>
  111. @endsection
  112. @section('script')
  113. <script type="text/javascript" src="{{ theme_asset('app/js/regular.js') }}"></script>
  114. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.disappear.tooltip.js') }}"></script>
  115. <script type="text/javascript" src="{{ theme_asset('app/js/jquery.validate.js') }}"></script>
  116. @include('module.widgets.thirdlogin_bind', ['redirect_url'=>route('com.security'), 'redirect_name'=>"账号安全"])
  117. <script type="text/javascript">
  118. $('#J_edit_password').click(function(){
  119. var qsDialog = $(this).dialog({
  120. title: '修改密码',
  121. loading: true,
  122. showFooter: false,
  123. yes: function() {
  124. var options = {};
  125. options['oldpassword'] = $('#J_passwordWrap').find('input[name="oldpassword"]').val();
  126. options['password'] = $('#J_passwordWrap').find('input[name="password"]').val();
  127. options['password1'] = $('#J_passwordWrap').find('input[name="password1"]').val();
  128. options['_token'] = "{{csrf_token()}}";
  129. $.ajax({
  130. method: 'post',
  131. url: '{{ route('savePwd') }}',
  132. data: options,
  133. beforeSend:function () {
  134. },
  135. complete:function() {
  136. },
  137. success: function (data) {
  138. disapperTooltip('success',data.data);
  139. location.reload();
  140. },
  141. error: function (errorData) {
  142. if (errorData.status==422) {//验证错误
  143. // console.log(errorData.errors);return ;
  144. $.each(errorData.responseJSON.errors,function (key,val) {
  145. disapperTooltip("remind", val[0]);
  146. });
  147. }
  148. else if(errorData.status==400) {//业务错误
  149. disapperTooltip("remind", errorData.responseJSON.message);
  150. }
  151. },
  152. });
  153. }
  154. });
  155. $.get("{{route('modifyPwd')}}",function(result){
  156. qsDialog.setCloseDialog(false);
  157. qsDialog.setContent(result);
  158. qsDialog.showFooter(true);
  159. });
  160. });
  161. var regularUsername = /^(?=[\u4e00-\u9fa5a-zA-Z])(?!\d+)[\u4e00-\u9fa5\w.]{6,20}$/;
  162. $('#J_edit_uname').click(function(){
  163. var qsDialog = $(this).dialog({
  164. title: '修改用户名',
  165. loading: true,
  166. showFooter: false,
  167. yes: function() {
  168. var username = $.trim($('#J_usernameInput').val());
  169. if (!username.length) {
  170. disapperTooltip("remind", '请填写新用户名');
  171. $('#J_usernameInput').focus();
  172. return false;
  173. }
  174. if (username.length && !regularUsername.test(username)) {
  175. disapperTooltip("remind", "用户名中英文开头6-20位,无特殊符号");
  176. $('#J_usernameInput').focus();
  177. return false;
  178. }
  179. $.ajax({
  180. method: 'post',
  181. url: '{{ route('saveUsername') }}',
  182. data: {username:username,_token:"{{csrf_token()}}"},
  183. beforeSend:function () {
  184. },
  185. complete:function() {
  186. },
  187. success: function (data) {
  188. disapperTooltip('success',data.data);
  189. location.reload();
  190. },
  191. error: function (errorData) {
  192. if (errorData.status==422) {//验证错误
  193. // console.log(errorData.errors);return ;
  194. $.each(errorData.responseJSON.errors,function (key,val) {
  195. disapperTooltip("remind", val[0]);
  196. });
  197. }
  198. else if(errorData.status==400) {//业务错误
  199. disapperTooltip("remind", errorData.message);
  200. }
  201. },
  202. });
  203. }
  204. });
  205. $.get("{{ route('modifyUsername') }}",function(result){
  206. // if(result.status == 1){
  207. qsDialog.setCloseDialog(false);
  208. qsDialog.setContent(result);
  209. qsDialog.showFooter(true);
  210. // }else{
  211. // qsDialog.setContent('<div class="confirm">' + result.msg + '</div>');
  212. // }
  213. });
  214. });
  215. $('#J_auth_email').click(function(){
  216. var f = $(this);
  217. var auth = $(this).data('auth');
  218. var title = '认证邮箱';
  219. if(auth == 1){
  220. title = '修改已认证邮箱';
  221. }
  222. var qsDialog = $(this).dialog({
  223. title: title,
  224. loading: true,
  225. border: false,
  226. footer: false
  227. });
  228. $.get("{{ route('authEmail') }}",function(result){
  229. if(result.status) {
  230. qsDialog.hide();
  231. var qsDialogSon = $(this).dialog({
  232. title: title,
  233. border: false,
  234. content: result.data,
  235. footer: false
  236. });
  237. } else {
  238. qsDialog.hide();
  239. disapperTooltip('remind',result.msg);
  240. }
  241. });
  242. });
  243. $('#J_bind_weixin').click(function(){
  244. location.href=wechat_bind_url;
  245. });
  246. $('#J_bind_qq').click(function(){
  247. location.href=qq_bind_url;
  248. });
  249. $('.J_unlogin').click(function(){
  250. var url = $(this).attr('url'),
  251. name = $(this).attr('name'),
  252. qsDialog=$(this).dialog({
  253. title: '取消绑定',
  254. loading: false,
  255. border: false,
  256. content : '当前账号已绑定<'+name+'><br/>确定解绑吗?',
  257. yes: function() {
  258. $.get(url,function (res) {
  259. if(res.status) {
  260. disapperTooltip('success',res.msg);
  261. } else {
  262. disapperTooltip('remind',res.msg);
  263. }
  264. setTimeout(function () {
  265. window.location.reload();
  266. },2000)
  267. })
  268. }
  269. });
  270. });
  271. $('#J_auth_mobile').click(function(){
  272. var f = $(this);
  273. var auth = f.data('auth');
  274. var title = '认证手机';
  275. if(auth == 1){
  276. title = '修改已认证手机';
  277. }
  278. var qsDialog = $(this).dialog({
  279. title: title,
  280. loading: true,
  281. border: false,
  282. footer: false
  283. });
  284. $.get("{{ route('authMobile')}}",function(result){
  285. qsDialog.hide();
  286. var qsDialogSon = $(this).dialog({
  287. title: title,
  288. border: false,
  289. content: result,
  290. yes: function() {
  291. var mobile = $.trim($('#J_mobileWrap input[name="mobile"]').val());
  292. if(mobile == ''){
  293. $('#J_mobileWrap .J_errbox').text('手机号不能不空!').show();
  294. return false;
  295. }
  296. if (mobile != "" && !regularMobile.test(mobile)) {
  297. $('#J_mobileWrap .J_errbox').text('手机号码格式不正确!').show();
  298. return false;
  299. }
  300. var verifycode = $.trim($('#J_mobileWrap input[name="verifycode"]').val());
  301. if(!verifycode){
  302. $('#J_mobileWrap .J_errbox').text('请填写验证码!').show();
  303. return false;
  304. }
  305. var postData = {mobile:mobile,id:"{{auth('web-company')->user()->id}}",verifycode:verifycode,_token:'{{csrf_token()}}'}
  306. $.post("{{ route('mobile.audit') }}",postData,function(result){
  307. if(result.status == 1){
  308. qsDialogSon.hide();
  309. f.text('修改');
  310. $('#J_mobileStatus').html('<div class="yes">已认证</div>');
  311. $('#J_mobileWrap').html(result.data.mobile+'<span>(认证后可使用该手机登录账号、找回密码)</span>');
  312. if(result.data.points){
  313. disapperTooltip("goldremind", '验证手机号增加'+result.data.points+'积分<span class="point">+'+result.data.points+'</span>');
  314. }else{
  315. disapperTooltip('success',result.msg);
  316. }
  317. } else {
  318. $('#J_mobileWrap .J_errbox').text(result.msg).show();
  319. }
  320. },'json');
  321. }
  322. });
  323. qsDialogSon.setCloseDialog(false);
  324. });
  325. });
  326. </script>
  327. @endsection