Commit 419a2292 authored by Kajal's avatar Kajal

feat: Login API

parent dcd484f6
#include<iostream>
#include"utils.h"
using namespace std;
int main() {
char* nm, pwd;
cout<<"Enter your name"<<endl;
cin>>nm;
cout<<"Enter your password"<<endl;
cin>>pwd;
if (login(nm, pwd)==true) cout<<"Success!"<<endl;
else cout<<"Login failed :("<<endl;
}
\ No newline at end of file
#ifndef PASSWORDS_H
#define PASWSWORDS_H
#include<map>
#include<string>
using namespace std;
map<string, string> passwords {
{"Tinsmorem","Iltil"},
{"Ulyglet","Snurgrurg"},
{"Lafibnom","Diamdioc"},
{"Thenbovir","Oudrarrouz"},
{"Gallnip","Haulmi"},
{"Froolvess","Holdiz"},
{"Smameknuc","Hinnyual"},
{"Smedekmet","Traolbubrorg"},
{"Cebbnec","Khishohi"},
{"Klolyddwac","Maennius"},
{"Blivylnas","Jolmuulmohr"},
{"Glyhamdas","Drustiel"},
{"Hillnar","Nanruddiarth"},
{"Phieddlu","Zussial"},
{"Fnamdyn","Laszo"},
{"Fladnivith","Nathentoih"},
{"Phelnyll","Phorughoelle"},
{"Snallbam","Skilzeda"},
{"Fensmyl","Vrakniarth"},
{"Pibkecim","Jerpuldo"}
};
//Return true only if the person is present in the database
bool find_user(string name){
if(passwords.find(name) != passwords.end()) return true;
else return false;
}
//Returns the password for a particular person
string get_password(string name){
return passwords[name];
}
#endif
#include<iostream>
#include"password.h"
using namespace std;
map<strings,strings> passwords;
bool login(string name, string password) {
if(passwords.find(name) != passwords.end() && passwords[name]==password) return true;
else return false;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment