Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
2
200050056-200050102-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
Kajal
200050056-200050102-git
Commits
419a2292
Commit
419a2292
authored
Aug 05, 2021
by
Kajal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Login API
parent
dcd484f6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
0 deletions
+66
-0
main.cpp
main.cpp
+13
-0
passwords.h
passwords.h
+43
-0
utils.h
utils.h
+10
-0
No files found.
main.cpp
0 → 100644
View file @
419a2292
#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
passwords.h
0 → 100644
View file @
419a2292
#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 @
419a2292
#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
;
}
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