Answer the question
In order to leave comments, you need to log in
How to implement access to information by password python bot?
implement a button, when you click on it, you are prompted to enter a login / password; if the password is correct, then display a certain text.
Tell me how to implement it?
Answer the question
In order to leave comments, you need to log in
Here is a solution to check if the username/password is correct. It is assumed that you either separate the login\password from one message sent to the bot by the user. Or you will receive a pair of login \ password from 2 messages.
def NewValideLogin(DataBase):
DataBase[input("Введите новый валидный логин: ")] = input("Введите пароль, для нового логина: ")
return DataBase
def RemoveLogin(DataBase):
del DataBase[input("Введите логин, который нужно удалить: ")]
return DataBase
DataBase = {'Admin':'AdminKrasavhicIMolodec228', 'User':'12340987'}
UserMessage1 = "Admin"
UserMessage2 = "AdminKrasavhicIMolodec228"
if UserMessage1 in DataBase:
print('Логин засчитало')
if UserMessage2 == DataBase[UserMessage1]:
print('Пароль засчитало')
else:
print('Пароль не засчитало')
else:
print("Логин не засчитало")
DataBase = NewValideLogin(DataBase)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question