Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added fixes #69

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/src/main/java/com/BugBazaar/controller/UserAuthSave.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ public class UserAuthSave {
private static final String KEY_USERNAME = "username";
private static final String KEY_PASSWORD = "password";
private static final String keypasscode = "passcode";
private static final String USER_DATA = "userCred";
private static SharedPreferences sharedPreferences1;

private static final String keypasscode_flag = "passcode_flag";
private static final String USER_DATA = "userCred";

private static SharedPreferences sharedPreferences;
private SessionManager sessionManager; // Move the initialization to a constructor
private static SharedPreferences sharedPreferences1;

public UserAuthSave(Context context) {
public UserAuthSave(Context context) {
sharedPreferences = context.getSharedPreferences(USER_PREFERENCES, Context.MODE_PRIVATE);
sessionManager = new SessionManager(context); // Initialize SessionManager in the constructor
sharedPreferences1 = context.getSharedPreferences(USER_DATA, Context.MODE_PRIVATE);
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/BugBazaar/ui/Signin.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ public void onClick(View v) {
boolean isLoggedin= loginController.validateLogin(username, password);

if (isLoggedin==true) {

String randomToken = TokenGenerator.generateRandomToken(64);
sessionManager.setLoggedIn(true);
userAuthSave.saveUserData( randomToken,isLoggedin);
userAuthSave.saveuserCred(username,password);
sessionManager.setLoggedIn(true);
String randomToken = TokenGenerator.generateRandomToken(64);
userAuthSave.saveUserData( randomToken,isLoggedin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class TermsAndConditionsActivity extends AppCompatActivity {
WebView webView;
private SessionManager sessionManager;

private String webViewUrl;

Expand Down Expand Up @@ -77,7 +78,7 @@ else if (webViewUrl.endsWith(".bugbazaar.com")){
}

private String getsessionid() {
return String.valueOf(UUID.randomUUID());
return sessionManager.getUserToken();
}

private class JavaScriptInterface {
Expand Down
Loading