Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Simmitive_Chris_Crook
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chris.crook
Simmitive_Chris_Crook
Commits
a6e15b2a
Commit
a6e15b2a
authored
Apr 08, 2021
by
chris.crook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
> login button pretty much done
parent
80b671f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
6 deletions
+50
-6
MainActivity.java
.../java/com/example/summative_chris_crook/MainActivity.java
+50
-6
No files found.
app/src/main/java/com/example/summative_chris_crook/MainActivity.java
View file @
a6e15b2a
...
@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity;
...
@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -57,7 +58,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -57,7 +58,7 @@ public class MainActivity extends AppCompatActivity {
if
(
tempload
.
equals
(
"&&&"
)){
if
(
tempload
.
equals
(
"&&&"
)){
// this means that the load failed
// this means that the load failed
}
}
else
{
/*
else{
// load successful
// load successful
if (tempload.equals("")){
if (tempload.equals("")){
// dont add a '#' to the start
// dont add a '#' to the start
...
@@ -88,7 +89,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -88,7 +89,7 @@ public class MainActivity extends AppCompatActivity {
System.out.println(tempint + "");
System.out.println(tempint + "");
}
}
System.out.println(tempint);
System.out.println(tempint);
}
}
*/
}
}
...
@@ -101,7 +102,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -101,7 +102,7 @@ public class MainActivity extends AppCompatActivity {
while
(
reader
.
hasNextLine
()){
while
(
reader
.
hasNextLine
()){
temp
=
temp
+
reader
.
nextLine
();
temp
=
temp
+
reader
.
nextLine
();
}
}
Toast
.
makeText
(
getApplicationContext
(),
temp
+
" "
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(getApplicationContext(), temp + " ", Toast.LENGTH_LONG).show();
return
temp
;
return
temp
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"read error"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
getApplicationContext
(),
"read error"
,
Toast
.
LENGTH_LONG
).
show
();
...
@@ -154,11 +155,14 @@ public class MainActivity extends AppCompatActivity {
...
@@ -154,11 +155,14 @@ public class MainActivity extends AppCompatActivity {
// load successful
// load successful
if
(
tempload
.
equals
(
""
)){
if
(
tempload
.
equals
(
""
)){
// dont add a '#' to the start
// dont add a '#' to the start
tempload
+=
"adminname&adminuser&adminpassword&ADMIN"
;
tempload
+=
"%examplename&exampleuser&examplepassword&USER"
;
}
}
else
{
else
{
tempload
+=
"#"
;
tempload
+=
"%"
;
tempload
+=
"adminname&adminuser&adminpassword&ADMIN"
;
tempload
+=
"%examplename&exampleuser&examplepassword&USER"
;
}
}
tempload
+=
"adminname&adminuser&adminpassword&ADMIN"
;
String
[]
temploadarray
=
tempload
.
split
(
"%"
);
String
[]
temploadarray
=
tempload
.
split
(
"%"
);
size
=
temploadarray
.
length
;
size
=
temploadarray
.
length
;
for
(
int
i
=
0
;
i
<
size
;
i
++){
for
(
int
i
=
0
;
i
<
size
;
i
++){
...
@@ -181,7 +185,47 @@ public class MainActivity extends AppCompatActivity {
...
@@ -181,7 +185,47 @@ public class MainActivity extends AppCompatActivity {
System
.
out
.
println
(
tempint
+
""
);
System
.
out
.
println
(
tempint
+
""
);
}
}
System
.
out
.
println
(
tempint
);
System
.
out
.
println
(
tempint
);
System
.
out
.
println
(
"RAW DATA: "
+
magicwords
[
0
]
[
0
]
+
" NAME: "
+
magicwords
[
0
]
[
1
]
+
" USERNAME: "
+
magicwords
[
0
]
[
2
]
+
" PASSWORD: "
+
magicwords
[
0
]
[
3
]
+
" ADMIN FLAG: "
+
magicwords
[
0
]
[
4
]);
/*for (int i = 0 ; i < 10; i++){
System.out.println(i);
System.out.println(">RAW DATA: " + magicwords [i] [0] + " >NAME: " + magicwords [i] [1] + " >USERNAME: " + magicwords [i] [2] + " >PASSWORD: " + magicwords [i] [3] + " >ADMIN FLAG: " + magicwords [i] [4]);
}*/
String
euser
=
((
EditText
)
findViewById
(
R
.
id
.
username_input
)).
getText
().
toString
();
String
epass
=
((
EditText
)
findViewById
(
R
.
id
.
password_input
)).
getText
().
toString
();
if
(
euser
.
equals
(
""
)){
Toast
.
makeText
(
getApplicationContext
(),
"Enter a valid Username"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
if
(
epass
.
equals
(
""
)){
Toast
.
makeText
(
getApplicationContext
(),
"Enter a valid Password"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
boolean
wasthereausername
=
false
;
for
(
int
i
=
0
;
i
<
sizeoverride
;
i
++){
if
(
euser
.
equals
(
magicwords
[
i
]
[
2
])){
// username exists
if
(
epass
.
equals
(
magicwords
[
i
]
[
3
])){
// login is verified
if
(
magicwords
[
i
]
[
4
].
equals
(
"ADMIN"
)){
// user is an admin
Toast
.
makeText
(
getApplicationContext
(),
"Signed in as admin"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"Signed in as user"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
}
else
{
wasthereausername
=
true
;
}
}
}
if
(
wasthereausername
){
Toast
.
makeText
(
getApplicationContext
(),
"Login details invalid (password)"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"Login details invalid (username)"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
}
...
...
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