MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / input_user_info

Method input_user_info

client/node/common/userinput.py:188–220  ·  view source on GitHub ↗

username,password 输入 :param scm_type: :param scm_url: :return:

(self, scm_type, scm_url)

Source from the content-addressed store, hash-verified

186 return None
187
188 def input_user_info(self, scm_type, scm_url):
189 """
190 username,password 输入
191 :param scm_type:
192 :param scm_url:
193 :return:
194 """
195 try:
196 if not scm_url or not scm_type: # 如果没有scm_url和scm_type,不能验证权限
197 logger.error("scm_url(%s) 或 scm_type(%s) 不能为空!" % (scm_url, scm_type))
198 return None
199
200 username = SmartInput().input("Username:")
201 password = SmartInput().input("Password:", is_password=True)
202
203 input_times = 3 # 账号密码输入3次错误,直接退出
204 # 通过访问远程仓库信息,判断账号密码是否正确
205
206 # 检查输入的账号密码是否有效
207 while not ScmClient(scm_type=scm_type,scm_url = scm_url,source_dir=None,
208 scm_username=username,scm_password=password).check_auth():
209 input_times -= 1
210 if not input_times:
211 # 超过失败重试次数,直接返回
212 logger.error("3次输入错误,退出!")
213 return None
214 logger.warning("账号密码不对,请重新输入!")
215 username = SmartInput().input("Username:")
216 password = SmartInput().input("Password:", is_password=True)
217 return {"username": username, "password": password}
218 except EOFError as err:
219 logger.warning(str(err))
220 return None
221
222 def input_languages(self):
223 """

Callers

nothing calls this directly

Calls 6

SmartInputClass · 0.90
ScmClientFunction · 0.90
errorMethod · 0.80
inputMethod · 0.80
warningMethod · 0.80
check_authMethod · 0.45

Tested by

no test coverage detected