Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
Your Cashier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Ahmad Abi Mulya
Your Cashier
Commits
d9b7029d
Commit
d9b7029d
authored
Aug 28, 2020
by
Ahmad Abi Mulya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to fix login validation
parent
f6bc1965
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
35 deletions
+6
-35
ForgetPassword.java
...om/example/yourcashiertest/activities/ForgetPassword.java
+1
-0
LoginActivity.java
...com/example/yourcashiertest/activities/LoginActivity.java
+3
-9
activity_forget_password.xml
app/src/main/res/layout/activity_forget_password.xml
+1
-25
activity_login.xml
app/src/main/res/layout/activity_login.xml
+1
-1
No files found.
app/src/main/java/com/example/yourcashiertest/activities/ForgetPassword.java
View file @
d9b7029d
...
...
@@ -48,6 +48,7 @@ public class ForgetPassword extends AppCompatActivity {
userViewModel
.
resetPassword
(
users
.
get
(
i
).
getId
()
,
password
);
binding
.
setLoading
(
false
);
startActivity
(
new
Intent
(
ForgetPassword
.
this
,
LoginActivity
.
class
));
finish
();
return
;
}
}
...
...
app/src/main/java/com/example/yourcashiertest/activities/LoginActivity.java
View file @
d9b7029d
...
...
@@ -32,9 +32,7 @@ public class LoginActivity extends AppCompatActivity {
checkSession
();
finish
();
}
viewModel
=
new
ViewModelProvider
(
this
,
new
ViewModelProvider
.
NewInstanceFactory
()).
get
(
UserViewModel
.
class
);
binding
.
btnLogin
.
setOnClickListener
(
view
->
{
if
(
binding
.
etUsername
.
getText
().
toString
().
length
()
==
0
||
binding
.
etPassword
.
getText
().
toString
().
length
()
==
0
){
Toast
.
makeText
(
getApplicationContext
(),
"Please input Username and Password"
,
Toast
.
LENGTH_SHORT
).
show
();
...
...
@@ -49,11 +47,9 @@ public class LoginActivity extends AppCompatActivity {
}
});
}
public
void
tvForgetPassword
(
View
view
)
{
startActivity
(
new
Intent
(
LoginActivity
.
this
,
ForgetPassword
.
class
));
}
public
void
tvSignUpHere
(
View
view
)
{
startActivity
(
new
Intent
(
LoginActivity
.
this
,
RegisterActivity
.
class
));
}
...
...
@@ -68,13 +64,11 @@ public class LoginActivity extends AppCompatActivity {
startActivity
(
new
Intent
(
LoginActivity
.
this
,
MainActivity
.
class
).
putExtra
(
DATA_LOGIN
,
users
.
get
(
i
).
getFullName
()).
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
).
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
));
finish
();
return
;
}
else
if
(!
binding
.
etUsername
.
getText
().
toString
().
equals
(
users
.
get
(
i
).
getEmail
()))
{
binding
.
etUsername
.
setError
(
"Email Not Found!"
);
}
else
if
(!
binding
.
etPassword
.
getText
().
toString
().
equals
(
users
.
get
(
i
).
getPassword
()))
{
binding
.
etPassword
.
setError
(
"Password Wrong!"
);
}
}
Toast
.
makeText
(
LoginActivity
.
this
,
"User Not Found!"
,
Toast
.
LENGTH_LONG
).
show
();
binding
.
setLoading
(
false
);
return
;
});
}
catch
(
Exception
e
){
e
.
printStackTrace
();
...
...
app/src/main/res/layout/activity_forget_password.xml
View file @
d9b7029d
...
...
@@ -53,30 +53,6 @@
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilCrPw"
app:passwordToggleEnabled=
"true"
app:boxBackgroundColor=
"@color/white"
android:textColorHint=
"@color/grey"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/tilEmail"
android:layout_marginTop=
"20dp"
android:layout_marginStart=
"@dimen/space_default"
android:layout_marginEnd=
"@dimen/space_default"
android:layout_marginBottom=
"@dimen/space_default"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etCrPw"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Current Password"
android:imeOptions=
"actionNext"
android:inputType=
"text"
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilNewPw"
app:passwordToggleEnabled=
"true"
...
...
@@ -85,7 +61,7 @@
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/til
CrPw
"
app:layout_constraintTop_toBottomOf=
"@id/til
Email
"
android:layout_marginTop=
"20dp"
android:layout_marginStart=
"@dimen/space_default"
android:layout_marginEnd=
"@dimen/space_default"
...
...
app/src/main/res/layout/activity_login.xml
View file @
d9b7029d
...
...
@@ -104,7 +104,7 @@
android:id=
"@+id/tvDontHaveAnAccount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"
4
0dp"
android:layout_marginStart=
"
5
0dp"
android:text=
"@string/dont_have_an_account"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/tvSignUpHere"
...
...
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