From f8d04452444991802473b0f28df644b132e5e085 Mon Sep 17 00:00:00 2001 From: hnu202326010401 <2263510185@qq.com> Date: Tue, 30 Sep 2025 15:41:40 +0800 Subject: [PATCH] ADD file via upload --- src/account.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/account.cpp diff --git a/src/account.cpp b/src/account.cpp new file mode 100644 index 0000000..b1ee00b --- /dev/null +++ b/src/account.cpp @@ -0,0 +1,24 @@ +#include"account.h" + +Authenticator::Authenticator(){ + users = { + User("张三1","123","小学"), + User("张三2","123","小学"), + User("张三3","123","小学"), + User("李四1","123","初中"), + User("李四2","123","初中"), + User("李四3","123","初中"), + User("王五1","123","高中"), + User("王五2","123","高中"), + User("王五3","123","高中"), + }; +} + +User* Authenticator::authenticate(const std::string& username,const std::string& password){ + for(User& user : users){ + if(user.UserName == username&&user.Password == password){ + return &user; + } + } + return nullptr; +} \ No newline at end of file