mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	[系统用户]增加OTP动态密码二次认证
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
.form-box {
 | 
			
		||||
  position: fixed;
 | 
			
		||||
  top: 2.5em;
 | 
			
		||||
  top: 2em;
 | 
			
		||||
  bottom: 0;
 | 
			
		||||
  left: 0;
 | 
			
		||||
  right: 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACI,eAAA;EACA,UAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;;AAGJ;EACI,eAAA;EACA,WAAA;EACA,QAAA;EACA,SAAA;EACA,kBAAA;EACA,iBAAA;;AANJ,IAQC;EACC,kBAAA;EACA,yBAAA;;AAVF,IAaC;EACC,gBAAA;EACA,iBAAA;EACA,gBAAA;EACA,mBAAA;EACA,UAAA;;AAlBF,IAqBC;EACC,iBAAA;EACA,cAAA;EACA,WAAA;;AASD,mBALoC;EACjC;IACI,UAAA;IACA,iBAAA","file":"index.css"}
 | 
			
		||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACI,eAAA;EACA,QAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;;AAGJ;EACI,eAAA;EACA,WAAA;EACA,QAAA;EACA,SAAA;EACA,kBAAA;EACA,iBAAA;;AANJ,IAQC;EACC,kBAAA;EACA,yBAAA;;AAVF,IAaC;EACC,gBAAA;EACA,iBAAA;EACA,gBAAA;EACA,mBAAA;EACA,UAAA;;AAlBF,IAqBC;EACC,iBAAA;EACA,cAAA;EACA,WAAA;;AASD,mBALoC;EACjC;IACI,UAAA;IACA,iBAAA","file":"index.css"}
 | 
			
		||||
@@ -28,7 +28,7 @@
 | 
			
		||||
				<div class="ui field">
 | 
			
		||||
					<div class="ui left icon input">
 | 
			
		||||
						<i class="ui user icon"></i>
 | 
			
		||||
						<input type="text" name="username" v-model="username" placeholder="请输入用户名" maxlength="200" ref="usernameRef"/>
 | 
			
		||||
						<input type="text" name="username" v-model="username" placeholder="请输入用户名" maxlength="200" ref="usernameRef" @input="changeUsername"/>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="ui field">
 | 
			
		||||
@@ -37,6 +37,12 @@
 | 
			
		||||
						<input type="password" v-model="password" placeholder="请输入密码" maxlength="200" @input="changePassword()" ref="passwordRef"/>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
                <div class="ui field" v-show="showOTP">
 | 
			
		||||
                    <div class="ui left icon input">
 | 
			
		||||
                        <i class="ui barcode icon"></i>
 | 
			
		||||
                        <input type="text" name="otpCode" placeholder="请输入OTP动态密码" maxlength="6"/>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
				<div class="ui field">
 | 
			
		||||
					<a href="" @click.prevent="showMoreOptions()">更多选项 <i class="icon angle" :class="{down:!moreOptionsVisible, up:moreOptionsVisible}"></i> </a>
 | 
			
		||||
				</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,28 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.username = "";
 | 
			
		||||
	this.password = "";
 | 
			
		||||
	this.passwordMd5 = "";
 | 
			
		||||
	this.encodedFrom = window.encodeURIComponent(this.from);
 | 
			
		||||
	this.username = ""
 | 
			
		||||
	this.password = ""
 | 
			
		||||
	this.passwordMd5 = ""
 | 
			
		||||
	this.encodedFrom = window.encodeURIComponent(this.from)
 | 
			
		||||
 | 
			
		||||
	this.isSubmitting = false;
 | 
			
		||||
	this.showOTP = false
 | 
			
		||||
 | 
			
		||||
	this.isSubmitting = false
 | 
			
		||||
 | 
			
		||||
	this.$delay(function () {
 | 
			
		||||
		this.$find("form input[name='username']").focus();
 | 
			
		||||
		this.changePassword();
 | 
			
		||||
		this.$find("form input[name='username']").focus()
 | 
			
		||||
		this.changePassword()
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	this.changeUsername = function () {
 | 
			
		||||
		this.$post("/checkOTP")
 | 
			
		||||
			.params({
 | 
			
		||||
				username: this.username
 | 
			
		||||
			})
 | 
			
		||||
			.success(function (resp) {
 | 
			
		||||
				this.showOTP = resp.data.requireOTP
 | 
			
		||||
			})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.changePassword = function () {
 | 
			
		||||
		this.passwordMd5 = md5(this.password.trim());
 | 
			
		||||
	};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
.form-box {
 | 
			
		||||
    position: fixed;
 | 
			
		||||
    top: 2.5em;
 | 
			
		||||
    top: 2em;
 | 
			
		||||
    bottom: 0;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    right: 0;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user