Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Dehm
briar
Commits
3ddfe44b
Commit
3ddfe44b
authored
11 years ago
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Show feedback during setup if passwords don't match. Dev task #49.
parent
bacd8ec0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
briar-android/res/values/strings.xml
+1
-0
1 addition, 0 deletions
briar-android/res/values/strings.xml
briar-android/src/org/briarproject/android/SetupActivity.java
+24
-9
24 additions, 9 deletions
...r-android/src/org/briarproject/android/SetupActivity.java
with
25 additions
and
9 deletions
briar-android/res/values/strings.xml
+
1
−
0
View file @
3ddfe44b
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
<string
name=
"choose_password"
>
Choose your password:
</string>
<string
name=
"choose_password"
>
Choose your password:
</string>
<string
name=
"confirm_password"
>
Confirm your password:
</string>
<string
name=
"confirm_password"
>
Confirm your password:
</string>
<string
name=
"format_min_password"
>
Password must be at least %1$d characters long
</string>
<string
name=
"format_min_password"
>
Password must be at least %1$d characters long
</string>
<string
name=
"passwords_do_not_match"
>
Passwords do not match
</string>
<string
name=
"enter_password"
>
Enter your password:
</string>
<string
name=
"enter_password"
>
Enter your password:
</string>
<string
name=
"try_again"
>
Wrong password, try again:
</string>
<string
name=
"try_again"
>
Wrong password, try again:
</string>
<string
name=
"expiry_warning"
>
This software has expired.\nPlease install a newer version.
</string>
<string
name=
"expiry_warning"
>
This software has expired.\nPlease install a newer version.
</string>
...
...
This diff is collapsed.
Click to expand it.
briar-android/src/org/briarproject/android/SetupActivity.java
+
24
−
9
View file @
3ddfe44b
...
@@ -26,10 +26,12 @@ import org.briarproject.api.crypto.CryptoExecutor;
...
@@ -26,10 +26,12 @@ import org.briarproject.api.crypto.CryptoExecutor;
import
org.briarproject.api.crypto.KeyPair
;
import
org.briarproject.api.crypto.KeyPair
;
import
org.briarproject.api.db.DatabaseConfig
;
import
org.briarproject.api.db.DatabaseConfig
;
import
org.briarproject.util.StringUtils
;
import
org.briarproject.util.StringUtils
;
import
roboguice.activity.RoboActivity
;
import
roboguice.activity.RoboActivity
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences.Editor
;
import
android.content.SharedPreferences.Editor
;
import
android.content.res.Resources
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.Editable
;
import
android.text.Editable
;
import
android.view.View
;
import
android.view.View
;
...
@@ -48,6 +50,7 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
...
@@ -48,6 +50,7 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
@Inject
@CryptoExecutor
private
Executor
cryptoExecutor
;
@Inject
@CryptoExecutor
private
Executor
cryptoExecutor
;
private
EditText
nicknameEntry
=
null
;
private
EditText
nicknameEntry
=
null
;
private
EditText
passwordEntry
=
null
,
passwordConfirmation
=
null
;
private
EditText
passwordEntry
=
null
,
passwordConfirmation
=
null
;
private
TextView
feedback
=
null
;
private
Button
continueButton
=
null
;
private
Button
continueButton
=
null
;
private
ProgressBar
progress
=
null
;
private
ProgressBar
progress
=
null
;
...
@@ -125,13 +128,13 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
...
@@ -125,13 +128,13 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
passwordConfirmation
.
setInputType
(
inputType
);
passwordConfirmation
.
setInputType
(
inputType
);
layout
.
addView
(
passwordConfirmation
);
layout
.
addView
(
passwordConfirmation
);
TextView
minPasswordLength
=
new
TextView
(
this
);
feedback
=
new
TextView
(
this
);
minPasswordLength
.
setGravity
(
CENTER
);
feedback
.
setGravity
(
CENTER
);
minPasswordLength
.
setTextSize
(
14
);
feedback
.
setTextSize
(
14
);
minPasswordLength
.
setPadding
(
10
,
10
,
10
,
10
);
feedback
.
setPadding
(
10
,
10
,
10
,
10
);
String
format
=
getResources
().
getString
(
R
.
string
.
format_min_password
);
String
format
=
getResources
().
getString
(
R
.
string
.
format_min_password
);
minPasswordLength
.
setText
(
String
.
format
(
format
,
MIN_PASSWORD_LENGTH
));
feedback
.
setText
(
String
.
format
(
format
,
MIN_PASSWORD_LENGTH
));
layout
.
addView
(
minPasswordLength
);
layout
.
addView
(
feedback
);
continueButton
=
new
Button
(
this
);
continueButton
=
new
Button
(
this
);
continueButton
.
setLayoutParams
(
WRAP_WRAP
);
continueButton
.
setLayoutParams
(
WRAP_WRAP
);
...
@@ -142,6 +145,7 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
...
@@ -142,6 +145,7 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
progress
=
new
ProgressBar
(
this
);
progress
=
new
ProgressBar
(
this
);
progress
.
setLayoutParams
(
WRAP_WRAP
);
progress
.
setLayoutParams
(
WRAP_WRAP
);
progress
.
setPadding
(
0
,
10
,
0
,
0
);
progress
.
setIndeterminate
(
true
);
progress
.
setIndeterminate
(
true
);
progress
.
setVisibility
(
GONE
);
progress
.
setVisibility
(
GONE
);
layout
.
addView
(
progress
);
layout
.
addView
(
progress
);
...
@@ -162,6 +166,15 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
...
@@ -162,6 +166,15 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
boolean
passwordsMatch
=
Arrays
.
equals
(
firstPassword
,
secondPassword
);
boolean
passwordsMatch
=
Arrays
.
equals
(
firstPassword
,
secondPassword
);
for
(
int
i
=
0
;
i
<
firstPassword
.
length
;
i
++)
firstPassword
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<
firstPassword
.
length
;
i
++)
firstPassword
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<
secondPassword
.
length
;
i
++)
secondPassword
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<
secondPassword
.
length
;
i
++)
secondPassword
[
i
]
=
0
;
if
(!
passwordLength
)
{
Resources
res
=
getResources
();
String
format
=
res
.
getString
(
R
.
string
.
format_min_password
);
feedback
.
setText
(
String
.
format
(
format
,
MIN_PASSWORD_LENGTH
));
}
else
if
(!
passwordsMatch
)
{
feedback
.
setText
(
R
.
string
.
passwords_do_not_match
);
}
else
{
feedback
.
setText
(
""
);
}
boolean
valid
=
nicknameNotEmpty
&&
passwordLength
&&
passwordsMatch
;
boolean
valid
=
nicknameNotEmpty
&&
passwordLength
&&
passwordsMatch
;
continueButton
.
setEnabled
(
valid
);
continueButton
.
setEnabled
(
valid
);
}
}
...
@@ -174,13 +187,15 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
...
@@ -174,13 +187,15 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
}
}
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
// Replace the feedback text and button with a progress bar
feedback
.
setVisibility
(
GONE
);
continueButton
.
setVisibility
(
GONE
);
progress
.
setVisibility
(
VISIBLE
);
// Copy the passwords and erase the originals
final
String
nickname
=
nicknameEntry
.
getText
().
toString
();
final
String
nickname
=
nicknameEntry
.
getText
().
toString
();
final
char
[]
password
=
getChars
(
passwordEntry
.
getText
());
final
char
[]
password
=
getChars
(
passwordEntry
.
getText
());
delete
(
passwordEntry
.
getText
());
delete
(
passwordEntry
.
getText
());
delete
(
passwordConfirmation
.
getText
());
delete
(
passwordConfirmation
.
getText
());
// Replace the button with a progress bar
continueButton
.
setVisibility
(
GONE
);
progress
.
setVisibility
(
VISIBLE
);
// Store the DB key and create the identity in a background thread
// Store the DB key and create the identity in a background thread
cryptoExecutor
.
execute
(
new
Runnable
()
{
cryptoExecutor
.
execute
(
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment