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
445bae67
Commit
445bae67
authored
Apr 08, 2021
by
chris.crook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
> register page wip added
parent
c6a84bce
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
192 additions
and
1 deletion
+192
-1
AdminMenu.java
...ain/java/com/example/summative_chris_crook/AdminMenu.java
+20
-0
MainActivity.java
.../java/com/example/summative_chris_crook/MainActivity.java
+16
-1
register_page.java
...java/com/example/summative_chris_crook/register_page.java
+82
-0
activity_admin_menu.xml
app/src/main/res/layout/activity_admin_menu.xml
+7
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+7
-0
activity_register_page.xml
app/src/main/res/layout/activity_register_page.xml
+60
-0
No files found.
app/src/main/java/com/example/summative_chris_crook/AdminMenu.java
View file @
445bae67
...
@@ -5,6 +5,10 @@ import androidx.appcompat.app.AppCompatActivity;
...
@@ -5,6 +5,10 @@ import androidx.appcompat.app.AppCompatActivity;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.Toast
;
import
java.io.File
;
import
java.io.FileWriter
;
public
class
AdminMenu
extends
AppCompatActivity
{
public
class
AdminMenu
extends
AppCompatActivity
{
...
@@ -18,4 +22,20 @@ public class AdminMenu extends AppCompatActivity {
...
@@ -18,4 +22,20 @@ public class AdminMenu extends AppCompatActivity {
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
public
void
ohhshiiiiii
(
View
view
){
// wipe the user login folder and reset it
File
file1
;
String
filename1
=
"magicwords"
;
file1
=
new
File
(
getApplicationContext
().
getFilesDir
(),
filename1
+
".txt"
);
try
{
FileWriter
stream
=
new
FileWriter
(
file1
,
false
);
stream
.
append
(
""
);
stream
.
close
();
Toast
.
makeText
(
getApplicationContext
(),
"User Accounts Wiped, Admin and Default accounts only"
,
Toast
.
LENGTH_SHORT
).
show
();
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"write error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/summative_chris_crook/MainActivity.java
View file @
445bae67
...
@@ -166,7 +166,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -166,7 +166,7 @@ public class MainActivity extends AppCompatActivity {
else
{
else
{
// 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
+=
"adminname&adminuser&adminpassword&ADMIN"
;
tempload
+=
"%examplename&exampleuser&examplepassword&USER"
;
tempload
+=
"%examplename&exampleuser&examplepassword&USER"
;
}
}
...
@@ -244,6 +244,21 @@ public class MainActivity extends AppCompatActivity {
...
@@ -244,6 +244,21 @@ public class MainActivity extends AppCompatActivity {
}
}
}
}
}
}
public
void
ohhshiiiiii
(
View
view
){
// wipe the user login folder and reset it
File
file1
;
String
filename1
=
"magicwords"
;
file1
=
new
File
(
getApplicationContext
().
getFilesDir
(),
filename1
+
".txt"
);
try
{
FileWriter
stream
=
new
FileWriter
(
file1
,
false
);
stream
.
append
(
""
);
stream
.
close
();
Toast
.
makeText
(
getApplicationContext
(),
"User Accounts Wiped, Admin and Default accounts only"
,
Toast
.
LENGTH_SHORT
).
show
();
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"write error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
//
//
}
}
\ No newline at end of file
app/src/main/java/com/example/summative_chris_crook/register_page.java
View file @
445bae67
...
@@ -5,6 +5,12 @@ import androidx.appcompat.app.AppCompatActivity;
...
@@ -5,6 +5,12 @@ import androidx.appcompat.app.AppCompatActivity;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.util.Scanner
;
public
class
register_page
extends
AppCompatActivity
{
public
class
register_page
extends
AppCompatActivity
{
...
@@ -18,4 +24,80 @@ public class register_page extends AppCompatActivity {
...
@@ -18,4 +24,80 @@ public class register_page extends AppCompatActivity {
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
}
}
public
void
createadmin
(
View
view
){
//
String
name
=
((
EditText
)
findViewById
(
R
.
id
.
Name_input
)).
getText
().
toString
();
String
user
=
((
EditText
)
findViewById
(
R
.
id
.
Username_input
)).
getText
().
toString
();
String
pass
=
((
EditText
)
findViewById
(
R
.
id
.
Password_input
)).
getText
().
toString
();
String
conf
=
((
EditText
)
findViewById
(
R
.
id
.
Password_confirm
)).
getText
().
toString
();
if
(
pass
.
equals
(
conf
)){
//
String
reassembly
=
"#"
+
name
+
"%"
+
user
+
"%"
+
pass
+
"%USER"
;
System
.
out
.
println
(
reassembly
);
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"The passwords do not match"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
}
public
void
createuser
(
View
view
){
//
String
name
=
((
EditText
)
findViewById
(
R
.
id
.
Name_input
)).
getText
().
toString
();
String
user
=
((
EditText
)
findViewById
(
R
.
id
.
Username_input
)).
getText
().
toString
();
String
pass
=
((
EditText
)
findViewById
(
R
.
id
.
Password_input
)).
getText
().
toString
();
String
conf
=
((
EditText
)
findViewById
(
R
.
id
.
Password_confirm
)).
getText
().
toString
();
if
(
name
.
equals
(
""
)){
Toast
.
makeText
(
getApplicationContext
(),
"Enter a Name"
,
Toast
.
LENGTH_SHORT
).
show
();
}
if
(
user
.
equals
(
""
)){
Toast
.
makeText
(
getApplicationContext
(),
"Enter a Username"
,
Toast
.
LENGTH_SHORT
).
show
();
}
if
(
pass
.
equals
(
""
)){
Toast
.
makeText
(
getApplicationContext
(),
"Enter a Password"
,
Toast
.
LENGTH_SHORT
).
show
();
}
if
(
conf
.
equals
(
""
)){
Toast
.
makeText
(
getApplicationContext
(),
"Enter a Password (confirmation)"
,
Toast
.
LENGTH_SHORT
).
show
();
}
if
(
pass
.
equals
(
conf
)){
// put all stuff together for saving to magicwords.txt
File
file1
;
String
filename1
=
"magicwords"
;
file1
=
new
File
(
getApplicationContext
().
getFilesDir
(),
filename1
+
".txt"
);
String
reassembly
=
name
+
"&"
+
user
+
"&"
+
pass
+
"&USER"
;
//System.out.println(reassembly);
String
temp
=
""
;
try
{
Scanner
reader
=
new
Scanner
(
file1
);
while
(
reader
.
hasNextLine
()){
temp
=
temp
+
reader
.
nextLine
();
}
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"File Error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
String
write
;
if
(
temp
.
equals
(
""
)){
write
=
"%"
+
reassembly
;
}
else
{
write
=
reassembly
;
}
try
{
FileWriter
stream
=
new
FileWriter
(
file1
,
true
);
stream
.
append
(
write
);
stream
.
close
();
Toast
.
makeText
(
getApplicationContext
(),
"User Account Created"
,
Toast
.
LENGTH_LONG
).
show
();
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"Internal File Error"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"The passwords do not match"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
}
}
}
\ No newline at end of file
app/src/main/res/layout/activity_admin_menu.xml
View file @
445bae67
...
@@ -23,5 +23,12 @@
...
@@ -23,5 +23,12 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:onClick=
"goback"
android:onClick=
"goback"
android:text=
"Log Out"
/>
android:text=
"Log Out"
/>
<Button
android:id=
"@+id/button6"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:onClick=
"ohhshiiiiii"
android:text=
"Wipe user login file"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
445bae67
...
@@ -49,6 +49,13 @@
...
@@ -49,6 +49,13 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:onClick=
"navigate"
android:onClick=
"navigate"
android:text=
"register"
/>
android:text=
"register"
/>
<Button
android:id=
"@+id/button8"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:onClick=
"ohhshiiiiii"
android:text=
"testing"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_register_page.xml
View file @
445bae67
...
@@ -23,5 +23,65 @@
...
@@ -23,5 +23,65 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:onClick=
"goback"
android:onClick=
"goback"
android:text=
"Log in page"
/>
android:text=
"Log in page"
/>
<TextView
android:id=
"@+id/textView5"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Enter Name:"
/>
<EditText
android:id=
"@+id/Name_input"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textPersonName"
/>
<TextView
android:id=
"@+id/textView6"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Enter Username:"
/>
<EditText
android:id=
"@+id/Username_input"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textPersonName"
/>
<TextView
android:id=
"@+id/textView7"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Enter Password:"
/>
<EditText
android:id=
"@+id/Password_input"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textPassword"
/>
<TextView
android:id=
"@+id/textView8"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Confirm Password:"
/>
<EditText
android:id=
"@+id/Password_confirm"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textPassword"
/>
<Button
android:id=
"@+id/button7"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:onClick=
"createuser"
android:text=
"Create User Account"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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