<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8" />
	<meta name="renderer" content="webkit"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title>华南师范大学统一身份验证登录</title>
	<!-- App favicon -->
	<link rel="shortcut icon" href="https://statics.scnu.edu.cn/statics/images/favicon.ico">
	<!-- App css -->
	<link rel="stylesheet" type="text/css" id="bs-default-stylesheet"  href="/AccountService/static/plugins/assets/css/bootstrap-creative.min.css"/>
	<link rel="stylesheet" type="text/css" id="app-default-stylesheet" href="/AccountService/static/plugins/assets/css/app-creative.min.css?ver=20260324"/>
	<link rel="stylesheet" type="text/css" id="bs-dark-stylesheet"     href="/AccountService/static/plugins/assets/css/bootstrap-creative-dark.min.css?ver=20260324"/>
	<link rel="stylesheet" type="text/css" id="app-dark-stylesheet"    href="/AccountService/static/plugins/assets/css/app-creative-dark.min.css?ver=20260324"/>
	<!-- customer css -->
	<link rel="stylesheet" type="text/css" href="/AccountService/static/fullscreen/css/customer.css?ver=20250916" />
	<!-- <link rel="stylesheet" type="text/css" href="/AccountService/static/fullscreen/css/style.css?ver=20231024002" /> -->
	<!-- icons -->
	<link rel="stylesheet" type="text/css" href="/AccountService/static/plugins/assets/css/icons.min.css"/>

</head>
<!--[if lte IE 9]>
<body>
<script>	
	window.location.href='../user/view_version_set.html?view_version=0';
</script>
<div style="display:none">
<![endif]-->
<!--[if !(IE)]><!-->
<body class="loading auth-fluid-pages pb-0">

<div class="auth-fluid">
	<!--Auth fluid left content -->
	<div class="auth-fluid-right">
		<div class="auth-user-testimonial d-none d-xl-block" style="background-color: #0000008f;bottom: 0;padding: 15px 0;">
			<p class="text-center d-none"><img class="mb-3" src="../static/fullscreen/images/scnuqy.jpg" alt=""></p>
			<h2 class="text-center mb-2 text-white">使用说明</h2>
			<p class="text-center lead">统一身份认证采用师生一卡通卡号为帐号，初始密码为身份证后八位（字母统一大写），港澳台学生以及留学生则需要将证件号码去除括号之后再按前面的规则计算。用户若用一卡通号登录过校园网，登录平台的密码与校园网密码一致。该账号是华南师范大学师生员工进入信息系统的唯一标识。账号重要，请勿转借使用。如初始密码有误，请用户凭一卡通到网络中心办公室更改。</p>
		</div> <!-- end auth-user-testimonial-->
	</div>
	<!-- end auth-fluid-form-box-->

	<!-- Auth fluid right content -->
	<div class="auth-fluid-form-box">
		<div class="align-items-center d-flex h-100">
			<div class="card-body">
				<!-- Logo -->
				<div class="d-none d-xl-block auth-brand text-center text-lg-left full-title">
					<div class="auth-logo">
						<a href="index.html" class="logo logo-dark text-center">
							<span class="logo-lg">
								<img src="../static/fullscreen/images/scnulogo.png" alt="" height="70">
							</span>
						</a>
						<a href="index.html" class="logo logo-light text-center">
							<span class="logo-lg">
								<img src="../static/fullscreen/images/scnulogo.png" alt="" height="70">
							</span>
						</a>
					</div>
				</div>

				<!-- title-->
				<div class="d-none d-xl-block full-title full-title">
					<h4 class="mt-0">统一身份认证登录</h4>
					<p class="text-muted mb-2">SSO services authentication</p>
				</div>
				<div class="d-block d-xl-none mb-2 simple-title">
					<div class="row">
						<div class="col-3 col-sm-2"><img src="../static/fullscreen/images/scnulogo-icon.png" alt=""></div>
						<div class="col-9 col-sm-10">
							<h4 class="mt-2 mb-1">统一身份认证登录</h4>
							<p class="text-muted mb-1">SSO services authentication</p>
						</div>
					</div>
				</div>
				<div class="alert alert-warning" role="alert">
					<i class="mdi mdi-alert-outline mr-2"></i> 您即将登录：<strong>综合服务平台</strong>
				</div>
				<ul class="nav nav-tabs nav-bordered login-tabs nav-justified">
					<li class="nav-item">
						<a id="password-link-btn" href="#password-form" data-toggle="tab" aria-expanded="true" class="nav-link active">账号密码登录</a>
					</li>
					<li class="nav-item">
						<a id="webauthn-link-btn" href="#fido-form" data-toggle="tab" aria-expanded="false" class="nav-link">WebAuthn登录</a>
					</li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="password-form">
						<!-- form -->
						<form id="login-form-password" action="../user/login.html" method="post">
							<div class="form-group">
								<!--  
								<a href="../user/account.html" class="text-muted float-right"><small>毕业生账号找回</small></a>
								-->
								<label for="emailaddress">登录账号 Account</label>
								<input id="account" name="account" 
									 class="form-control" type="text" autocomplete="off" required="" tabindex="1" placeholder="请输入登录账号">
							</div>
							<div id="password-box" class="form-group">
								<a href="../user/find.html" class="text-muted float-right"><small>忘记密码?</small></a>
								<label for="password">登录密码 Password</label>
								<div class="input-group input-group-merge">
									<input type="password" id="password" name="password" 
										class="form-control" autocomplete="off" tabindex="2" placeholder="请输入登录密码">
									<div class="input-group-append" data-password="false">
										<div class="input-group-text">
											<span class="password-eye"></span>
										</div>
									</div>
								</div>
							</div>							
							<div class="form-group code-input" style="display:none;">
								<label for="emailaddress">验证码 Vertification Code</label>
								<div class="input-group input-group-merge">
									<input type="text" id="password-random-code" name="rancode" onkeydown="if(event.keyCode==13){loginAction();}"
										class="form-control" tabindex="3" placeholder="请输入验证码">
									<div class="input-group-append">
										<div class="input-group-text verifycode">
											<img onclick="reloadcode()" class="codeimg" src="" alt="" width="96">
										</div>
									</div>
								</div>
							</div>
							<div class="form-group mt-2 text-center">
								<button id="btn-password-login" class="btn btn-primary btn-block auth-login-btn" 
									onclick="loginByPassword()" tabindex="4" type="button">登录 Sign in</button>
							</div>
						</form>
					</div>					
					<div class="tab-pane" id="fido-form">
						<!-- form -->
						<form action="javascript:;">
							<div class="form-group">
								<a href="###" class="text-muted float-right" data-toggle="modal" data-target="#webauthn-model"><small>什么是WebAuthn?</small></a>
								<label for="emailaddress">登录账号 Account</label>
								<input class="form-control" type="text" id="webauthn_user" autocomplete="off" required="" tabindex="1" placeholder="请输入登录账号">
							</div>
							<div class="form-group mt-2 text-center">
								<button id="btn-webauthn-login" onclick="loginByWebauthn()" class="btn btn-primary btn-block auth-login-btn" tabindex="4" type="button">登录 Sign in</button>
							</div>
						</form>
						<!-- end form-->
					</div>
					<!-- social-->
					<div class="text-center mt-3 row">
						<p class="text-center secrecy w-100">
							<i class="far fa-bell"></i> 严禁处理涉密文件资料
						</p>
						<p class="text-muted social-title font-16 col-4 col-xl-12 social">
							其他登录<br><small>Sign in with</small>
						</p>
						<ul class="social-list list-inline col-8 col-xl-12 social">
							<li class="list-inline-item">
								<a href="javascript:otherLogin(3);" class="social-list-item" title="QQ登录">
									<img src="../static/fullscreen/images/ic_qq.png" alt="">
								</a>
							</li>
							<li class="list-inline-item">
								<a href="javascript:otherLogin(10);" class="social-list-item" title="微信登录">
									<img src="../static/fullscreen/images/ic_wechat.png" alt="">
								</a>
							</li>
							<li class="list-inline-item">
								<a href="javascript:otherLogin(5);" class="social-list-item" title="微博登录">
									<img src="../static/fullscreen/images/ic_weibo.png" alt="">
								</a>
							</li>
							<li class="list-inline-item">
								<a href="../openapi/wechat_work.html?entranceId=6" class="social-list-item" title="企业微信登录">
									<img src="../static/fullscreen/images/ic_enterprise.png" alt="">
								</a>
							</li>
							<li class="list-inline-item d-none">
								<a href="javascript:fidoLogin();" class="social-list-item" title="外部免密">
									<img src="../static/fullscreen/images/ic_enterprise.png" alt="">
								</a>
							</li>
							<li class="list-inline-item d-none">
								<a href="javascript:webauthn();" class="social-list-item" title="内部免密">
									<img src="../static/fullscreen/images/ic_enterprise.png" alt="">
								</a>
							</li>
						</ul>
					</div>	
				<!-- end form-->
				</div>
				<!-- Footer-->
				<footer class="footer footer-alt">
					<p class="text-muted">华南师范大学 © 2026 | <a href="http://beian.miit.gov.cn/" target="_blank">粤ICP备05008875号</a></p>
				</footer>

			</div> <!-- end .card-body -->
		</div> <!-- end .align-items-center.d-flex.h-100-->		
	</div>
	<!-- end Auth fluid right content -->
	
</div>

<!-- 第三方免密认证弹框 -->
<div class="modal fade" id="fido-model" tabindex="-1" role="dialog"
	aria-hidden="true">
	<div class="modal-dialog modal-md modal-dialog-centered">
		<div id="fido-iframe" class="modal-content" style="width: 368px;height: 450px;">
			<iframe src="" width="368" height="450" style="">
			</iframe>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<!-- Webauthn认证弹框 -->
<div class="modal fade" id="webauthn-model" tabindex="-1" role="dialog"
	aria-hidden="true">
	<div class="modal-dialog modal-md modal-dialog-centered">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" id="myCenterModalLabel">WebAuthn介绍</h4>
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">×</button>
			</div>
			<div class="modal-body">
				<p>WebAuthn（Web 身份验证）是由万维网联盟（W3C）发布的 Web 标准。WebAuthn 是 FIDO 联盟指导下的 FIDO2 项目的核心组成部分。该项目的目标是标准化用户对基于 Web 的应用程序和服务的公钥认证的接口。</p>
				<p>WebAuthn全称Web Authentication API 使用asymmetric (public-key) cryptography (不对称加密)替代密码或SMS文本在网站上注册，验证， second-factor authentication(双因素验证). 解决了phishing(钓鱼)， data breaches(数据破坏)， SMS 文本攻击,其他双因素验证等重大安全问题. 同时显著提高易用性(因为用户不必管理许多越来越复杂的密码)。</p>
				<p>WebAuthn支持的生物验证方式包括：笔记本电脑的指纹识别和面部识别、安卓设备的指纹识别。追求高安全的用户还可额外购买兼容FIDO的实体安全密钥，FIDO完整支持包括：指纹识别、面部识别、虹膜识别、声音识别、实体密钥（USB连接、蓝牙连接、NFC连接），支持设备系统包括：Windows 10、Linux、Mac OS、Android、iOS、智能手表等。</p>
				<div class="form-group text-right">
					<button class="btn btn-success waves-effect" data-dismiss="modal">我知道了</button>
				</div>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<!-- 消息提示框 -->
<div class="modal fade" id="tips-model" tabindex="-1" role="dialog"
	aria-hidden="true">
	<div class="modal-dialog modal-md modal-dialog-centered">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" id="myCenterModalLabel">提示信息</h4>
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">×</button>
			</div>
			<div class="modal-body">
				<p id="msgtext"></p>
				<div class="form-group text-right">
					<button class="btn btn-danger waves-effect" data-dismiss="modal">确定</button>
				</div>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<!-- end auth-fluid-->
<!--[if lte IE 9]>
</div>
<![endif]-->
<!--[if !(IE)]><!-->
<!-- Vendor js -->
<script src="../static/plugins/assets/js/vendor.min.js"></script>
<!-- App js -->
<script src="../static/plugins/assets/js/app.min.js"></script>
<script src="../static/fullscreen/js/script.js?ver=20240419001"></script>
<script src="../static/plugins/cbor.js"></script>
<script>
	$(function(){
		checkOthreLoginShowState();
		setTimeout(
			function(){
				setLoginInfo();
			},
			360
		);
		
		$("#account").keydown(function(event){
			var keyCode=event.which;
			if(keyCode==13 || keyCode==9){
				focus2Element($("#password"));
			}
		});
		$("#password").keydown(function(event){
			var keyCode=event.which;
			var rancodeBoxShow=$("#password-random-code").is(":hidden");
			console.log("keyCode:"+keyCode);
			console.log("ranCode:"+rancodeBoxShow);
			if(rancodeBoxShow){
				if(keyCode==13){
					loginByPassword();
				}else if(keyCode==9){
					focus2Element($("#btn-password-login"));
				}
			}else{
				if(keyCode==13 || keyCode==9){
					focus2Element($("#password-random-code"));
				}
			}			
		});
		$("#password-random-code").keydown(function(event){
			var keyCode=event.which;
			if(keyCode==13 || keyCode==9){
				if(keyCode==13){
					loginByPassword();
				}else if(keyCode==9){
					focus2Element($("#btn-password-login"));
				}
			}
		});		
		$("#btn-password-login").keydown(function(event){
			var keyCode=event.which;
			if(keyCode==8){
				var rancodeBoxShow=$("#password-random-code").is(":hidden");
				if(rancodeBoxShow){
					focus2Element($("#password"));
				}else{
					focus2Element($("#password-random-code"));
				}
			}
		});
		$("#username").keydown(function(event){
			var keyCode=event.which;
			if(keyCode==13 || keyCode==9){
				focus2Element($("#otp-input-1"));
			}
		});
		$(".otp-input").each(function(){
			$(this).keypress(function(event){
				var keyCode=event.which;
				if(keyCode>=48 && keyCode<=57){	
					$(this).val("");
					var next=$(this).next();
					var has=$(next).val();
					if(has!=undefined){
						$(next).val("");
						focus2Element(next);
					}else{
						var rancodeBoxShow=$("#otp-random-code").is(":hidden");
						if(rancodeBoxShow){
							focus2Element($("#btn-otp-login"));
						}else{
							focus2Element($("#otp-random-code"));
						}
						
					}
				}else{
					event.preventDefault();
				}
			});
			$(this).keydown(function(event){
				var keyCode=event.which;
				if(keyCode==8){
					$(this).val("");
					var last=$(this).prev();
					var has=$(last).val();
					if(has!=undefined){
						focus2Element(last);
					}
				}else if(keyCode==9){
					$(this).val("");
					var next=$(this).next();
					var has=$(next).val();
					if(has!=undefined){
						$(next).val("");
						focus2Element(next);
					}else{
						var rancodeBoxShow=$("#otp-random-code").is(":hidden");
						if(rancodeBoxShow){
							focus2Element($("#btn-otp-login"));
						}else{
							focus2Element($("#otp-random-code"));
						}
					}
				}
			});
		});
		reloadcode();
		$("#otp-random-code").keydown(function(event){
			var keyCode=event.which;
			if(keyCode==13 || keyCode==9){
				if(keyCode==13){
					loginAction();
				}else if(keyCode==9){
					focus2Element($("#btn-otp-login"));
				}
			}
		});
		$("#btn-otp-login").keydown(function(event){
			var keyCode=event.which;
			if(keyCode==8){
				var rancodeBoxShow=$("#otp-random-code").is(":hidden");
				if(rancodeBoxShow){
					focus2Element($("#otp-input-6"));
				}else{
					var rancodeBoxShow=$("#otp-random-code").is(":hidden");
					if(rancodeBoxShow){
						focus2Element($("#otp-input-6"));
					}else{
						focus2Element($("#otp-random-code"));
					}
				}
			}
		});
		$("#webauthn_user").keydown(function(event){
			var keyCode=event.which;
			if(keyCode==13){
				loginByWebauthn();
			}else if(keyCode==9){
				focus2Element($("#btn-webauthn-login"));
			}
		});
	});
	
	var login_failure_num=0;

	function reloadcode() {
		if(login_failure_num>=3){
			var r=Math.random()*10;
			var randomImageUrl="../user/rancode.jpg?m="+r;
			$(".codeimg").attr("src",randomImageUrl);
		}
	}

	function loginByPassword(){
		var userName=$("#account").val();
		var password=$("#password").val();
		var rancode=$("#password-random-code").val();
		if(userName == "" || password == "" || (rancode == "" && login_failure_num>=3)) {	
			if(userName == "") {
				$("#msgtext").text("请输入您的登录账号");
				$("#tips-model").modal();
				$("#account").focus();
			}else if(password == "") {
				$("#msgtext").text("请输入您的登录密码");
				$("#tips-model").modal();
				$("#password").focus();
			}else if((rancode == "" && login_failure_num>=3)) {
				$("#msgtext").text("请输入图形验证码");
				$("#tips-model").modal();
				$("#password-random-code").focus();
			}
		}else{
			if(login_failure_num>=3){
				$.post("../user/checkrandom.html",{random:rancode},function(data,status){
					if(data.msgcode==0){	
						$("#login-form-password").submit();		
					}else{
						$("#msgtext").text(data.msgtext);
						$("#tips-model").modal();
						$("#password-random-code").focus();
						reloadcode();				
					}
				},'json');
			}else{
				$("#login-form-password").submit();	
			}
		}
	}
	
	function loginByWebauthn(){
		var userName=$("#webauthn_user").val();
		if(userName!=""){
			var params={user_name:userName};
			$.post("../fido/get_auth_info.html",params,function(data){
				if(data.msgcode==0){
					if(data.allowCredentials.length>0){
						var allowCredentials=[];
						for(var i=0;i<data.allowCredentials.length;i++){
							var temp={'id':base64ToUint8Array(data.allowCredentials[i].id),'type':data.allowCredentials[i].type,'transports':data.allowCredentials[i].transports};
							allowCredentials.push(temp);
						}
						var challenge=new TextEncoder().encode(data.challenge);
						const publicKeyCredentialCreationOptions={
								'challenge':challenge,
								'rpId':data.rpid,
								'allowCredentials':allowCredentials,							
								'timeout':300000
							};
						console.log(allowCredentials);
						navigator.credentials.get({'publicKey':publicKeyCredentialCreationOptions})
						.then(function(credentialInfo){
							var params={};
							params.id=arrayBufferToBase64(credentialInfo.rawId);
							params.authenticator_data=arrayBufferToBase64(credentialInfo.response.authenticatorData);
							params.client_data_json=arrayBufferToBase64(credentialInfo.response.clientDataJSON);
							params.signature=arrayBufferToBase64(credentialInfo.response.signature);
							if(credentialInfo.response.userHandle.length>0){
								params.user_handle=arrayBufferToBase64(credentialInfo.response.userHandle);
							}
							console.log(params);
							$.post("../fido/device_auth.html",params,function(data){
								if(data.msgcode==0){
									window.location.href=data.url;
								}else{
									alert(data.msgtext);
								}
							},"json");
						})
						.catch(function (error){
							console.log(error);
						});
					}else{
						$("#msgtext").text("您尚未绑定当前设备，无法使用该功能");
						$("#tips-model").modal();
					}
				}else{
					$("#msgtext").text(data.msgtext);
					$("#tips-model").modal();
				}
			},"json");
		}else{
			$("#msgtext").text("请输您的登录账号");
			$("#tips-model").modal();
		}
	}
	function loginAction(){
		$("#rancode-tips").hide();
		$("#password-tips").hide();
		$("#account-tips").hide();
		var userName=$("#account").val();
		var password=$("#password").val();
		var otp=getOTPInuptData("otp-input");
		var rancode=$("#rancode").val();
		if(loginType==1){
			if(userName == "" || password == "" || (rancode == "" && login_failure_num>=3)) {	
				if(userName == "") {
					$("#msgtext").text("请输入您的登录账号");
					$("#tips-model").modal();
					$("#account").focus();
				}else if(password == "") {
					$("#msgtext").text("请输入您的登录密码");
					$("#tips-model").modal();
					$("#password").focus();
				}else if((rancode == "" && login_failure_num>=3)) {
					$("#msgtext").text("请输入图形验证码");
					$("#tips-model").modal();
					$("#rancode").focus();
				}
			}else{
				if(login_failure_num>=3){
					$.post("../user/checkrandom.html",{random:$("#rancode").val()},function(data,status){
						if(data.msgcode==0){	
							$("#loginform").submit();		
						}else{
							$("#msgtext").text(data.msgtext);
							$("#tips-model").modal();
							$("#rancode").focus();
							reloadcode();				
						}
					},'json');
				}else{
					$("#password").attr("name","password")
					$("#loginform").submit();	
				}
			}
		}else if(loginType==2){
			if(userName == "" || otp == "") {	
				if(userName == "") {
					$("#msgtext").text("请输入您的登录账号");
					$("#tips-model").modal();
					$("#account").focus();
				}else if(otp == "") {
					$("#msgtext").text("请输入动态口令");
					$("#tips-model").modal();
				}else if(otp.length<6) {
					$("#msgtext").text("请输入完整的动态口令");
					$("#tips-model").modal();
				}
			}else{
				$("#password").val(otp);
				$("#password").attr("name","otp")
				$("#loginform").submit();	
			}
		}
	}
	
	function otherLogin(entranceId){
		var client_id=$("#client_id").val();
		var response_type=$("#response_type").val();
		var redirect_url=$("#redirect_url").val();var url="../openapi/entrance.html?entranceId="+entranceId;
		window.location.href=url;
	}
	
	function checkOthreLoginShowState(){
		var ua = window.navigator.userAgent.toLowerCase();
		if(ua.match(/wxwork/i) == 'wxwork' || ua.match(/MicroMessenger/i)=='micromessenger'){
			$(".social").hide();
		}
	}
	
	function fidoLogin(){
		var fidoLink=$("#fido-iframe iframe").attr("src");
		if(fidoLink==""){
			$("#fido-iframe iframe").attr("src","../fido/login.html");
		}
		$("#fido-model").modal();
	}
	function setLoginInfo(){
		const cookies=document.cookie.split(";");
		if(cookies.length>0){
			var notCookie=true;
			for(var i=0;i<cookies.length;i++){
				const cookieInfo=cookies[i].split("=");
				const keyName=cookieInfo[0];
				const keyData=cookieInfo[1];
				if(keyName.trim()=="login_type"){
					notCookie=false;
					console.log("上次登录类型："+keyData);
					//$(".nav-link").removeClass("active");
					if(keyData=="webauthn"){
						console.log("切换至webauthn登录框");
						$("#webauthn-link-btn").click();
					}else if(keyData=="otp"){
						console.log("切换至otp登录框");
						$("#otp-link-btn").click();
					}else {
						console.log("切换至password登录框");
						$("#password-link-btn").click();
					}
				}else if(keyName.trim()=="login_user"){
					$("#account").val(keyData);
					$("#username").val(keyData);
					$("#webauthn_user").val(keyData);
				}
			}
			if(notCookie){
				$("#account").focus();
			}
		}
	}
	
</script>

<!--<![endif]-->
</body>
</html>