Instance2:login interface

 
 
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Deakin"
# Email: 469792427@qq.com
# Date: 2018/1/8

#模拟登陆:
#1. 用户输入帐号密码进行登陆
#2. 用户信息保存在文件内
#. 用户密码输入错误三次后锁定用户
f_lock=open("lock_list",'r+',encoding="utf-8")
f_account=open("account",'r',encoding="utf-8")
account = input("pls key in your account name:")
while True:
    for lockline in f_lock:
        lockline=lockline.strip('\n')
        if account==lockline:    
            print("your account has been locked, pls contact the system administrator")
            exit()
        else:
            pass
    for accountline in f_account:
        (user,passwd)=accountline.strip('\n').split() #分辨判断account password是否匹配
        if account==user:
            count=0
            while count<3:
                password=input("pls key in your password:")
                if password==passwd:
                    print("welcome to login,%s"%(account))
                    exit()
                else:
                    if count!=2:
                        print("your password is not correct,pls try again,remain %s times"%(2-count))
                    elif count==2:   #在第三次输错的时候不打印还剩几次机会
                        pass
                count+=1
            else:
                f_lock.write(account+'\n')
                print("your account has been locked,pls contact your system administrator")
                exit()
    else:
        print("account don't existed")
        break

 

转载于:https://www.cnblogs.com/Deakin-Du/p/8218499.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<script lang="ts"> import { defineComponent, reactive, toRefs, getCurrentInstance } from "vue"; import GeetestCaptcha from "./components/GeetestCaptcha.vue"; declare global { interface Window { [propName: string]: never; } } export default defineComponent({ name: "App", components: { GeetestCaptcha, }, setup() { const instance: any = getCurrentInstance(); let data = reactive({ captchaConfig: { config: { captchaId: "54088bb07d2df3c46b79f80300b0abbe", language: "en", product: "bind", }, handler: captchaHandler, }, }); function login() { if (data.captchaConfig.config.product === "bind") { if (window.captchaObj) { (window as any).captchaObj.showCaptcha(); } else { alert("验证码怎么还没初始化完成呀"); return false; } } else { validate(); } } function validate() { var result = (window as any).captchaObj.getValidate(); if (!result) { alert("请先完成验证!"); return; } instance.proxy .$axios({ method: "get", url: "/demo/login", params: Object.assign(result, { captcha_id: "54088bb07d2df3c46b79f80300b0abbe", }), }) .then((res: any) => { if (res.data.result) { console.log(res.data); alert(res.data.result); } }); } function captchaHandler(captchaObj: any) { (window as any).captchaObj = captchaObj; captchaObj .appendTo("#captcha") .onReady(function () { console.log("ready"); }) .onNextReady(function () { console.log("nextReady"); }) .onBoxShow(function () { console.log("boxShow"); }) .onError(function (e: any) { console.log(e); }) .onSuccess(function () { if (data.captchaConfig.config.product === "bind") { validate(); } }); } return { login, ...toRefs(data), }; }, }); </script>
07-14

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值