Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
2
200050107-200050157-git
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pranjal
200050107-200050157-git
Commits
8e654b26
Commit
8e654b26
authored
Aug 07, 2021
by
PranjalKushwaha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Login API
parents
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
0 deletions
+77
-0
main.cpp
main.cpp
+16
-0
passwords.h
passwords.h
+43
-0
utils.h
utils.h
+18
-0
No files found.
main.cpp
0 → 100644
View file @
8e654b26
#include <iostream>
#include "utils.h"
int
main
()
{
string
name
,
password
;
cin
>>
name
>>
password
;
if
(
login
(
name
,
password
))
{
cout
<<
"Success!"
<<
endl
;
}
else
{
cout
<<
"Login Failed :("
<<
endl
;
}
}
\ No newline at end of file
passwords.h
0 → 100755
View file @
8e654b26
#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
utils.h
0 → 100644
View file @
8e654b26
#include "passwords.h"
bool
login
(
string
name
,
string
password
)
{
if
(
find_user
(
name
))
{
string
s
=
get_password
(
name
);
if
(
s
==
password
)
{
return
true
;
}
else
{
return
false
;
}
}
else
return
false
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment