From 5520d508ffed1a4392a8299caa711ddb28b734a2 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Sun, 4 Apr 2021 17:45:23 -0700 Subject: [PATCH] :sparkles: VerifyPassword --- include/bank.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/bank.hpp b/include/bank.hpp index ecdaf7e..19870f6 100644 --- a/include/bank.hpp +++ b/include/bank.hpp @@ -89,6 +89,15 @@ public: return state; } + int_fast32_t VerifyPassword(const std::string &name, const std::string &attempt) const + { + int_fast32_t res = -1; + users.if_contains(name, [&res, &attempt](const User &u) { + res = u.password == attempt; + }); + return res; + } + void Save() { Json::StreamWriterBuilder builder;