mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
commit
53e603dc46
@ -5,6 +5,7 @@ import com.amplifyframework.auth.AuthException;
|
|||||||
import com.amplifyframework.auth.AuthSession;
|
import com.amplifyframework.auth.AuthSession;
|
||||||
import com.amplifyframework.auth.cognito.AWSCognitoAuthSession;
|
import com.amplifyframework.auth.cognito.AWSCognitoAuthSession;
|
||||||
import com.amplifyframework.auth.options.AuthSignUpOptions;
|
import com.amplifyframework.auth.options.AuthSignUpOptions;
|
||||||
|
import com.amplifyframework.auth.result.AuthResetPasswordResult;
|
||||||
import com.amplifyframework.auth.result.AuthSignInResult;
|
import com.amplifyframework.auth.result.AuthSignInResult;
|
||||||
import com.amplifyframework.auth.result.AuthSignUpResult;
|
import com.amplifyframework.auth.result.AuthSignUpResult;
|
||||||
import com.amplifyframework.core.Amplify;
|
import com.amplifyframework.core.Amplify;
|
||||||
@ -21,6 +22,7 @@ public class AuthManager {
|
|||||||
AWSCognitoAuthSession authSession = null;
|
AWSCognitoAuthSession authSession = null;
|
||||||
AuthSignUpResult authSignUpResult = null;
|
AuthSignUpResult authSignUpResult = null;
|
||||||
AuthSignInResult authSignInResult = null;
|
AuthSignInResult authSignInResult = null;
|
||||||
|
AuthResetPasswordResult authResetPasswordResult = null;
|
||||||
AuthException authError = null;
|
AuthException authError = null;
|
||||||
String email = null;
|
String email = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
@ -90,10 +92,19 @@ public class AuthManager {
|
|||||||
waiting = false;
|
waiting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAuthResetPasswordResult(AuthResetPasswordResult toSet) {
|
||||||
|
authResetPasswordResult = toSet;
|
||||||
|
waiting = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void signOutSuccess() {
|
public void signOutSuccess() {
|
||||||
waiting = false;
|
waiting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void passwordResetSuccess() {
|
||||||
|
waiting = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void startSignUp(String email, String password) throws AuthException {
|
public void startSignUp(String email, String password) throws AuthException {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
@ -145,6 +156,19 @@ public class AuthManager {
|
|||||||
throwIfAuthError();
|
throwIfAuthError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changePassword(String email) throws AuthException {
|
||||||
|
this.email = email;
|
||||||
|
waiting = true;
|
||||||
|
Amplify.Auth.resetPassword(email, result -> setAuthResetPasswordResult(result), error -> setAuthError(error));
|
||||||
|
throwIfAuthError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void confirmPasswordReset(String newPassword, String confirmationCode) throws AuthException {
|
||||||
|
waiting = true;
|
||||||
|
Amplify.Auth.confirmResetPassword(newPassword, confirmationCode, this::passwordResetSuccess, this::setAuthError);
|
||||||
|
throwIfAuthError();
|
||||||
|
}
|
||||||
|
|
||||||
public static Properties loadProperties(Context context, String path) throws IOException, JSONException {
|
public static Properties loadProperties(Context context, String path) throws IOException, JSONException {
|
||||||
Properties toReturn = new Properties();
|
Properties toReturn = new Properties();
|
||||||
String propertiesJSONString = "";
|
String propertiesJSONString = "";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user