-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from alexandr7035/develop
Release v0.2-alpha - Add password reset feature
- Loading branch information
Showing
40 changed files
with
1,276 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: Unit tests | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on pull request events for the master branch | ||
pull_request: | ||
branches: [ master ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Run Unit Tests | ||
run: ./gradlew test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/src/main/java/by/alexandr7035/affinidi_id/data/LoginRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package by.alexandr7035.affinidi_id.data | ||
|
||
import by.alexandr7035.affinidi_id.data.model.log_out.LogOutModel | ||
import by.alexandr7035.affinidi_id.data.model.sign_in.SignInModel | ||
|
||
interface LoginRepository { | ||
suspend fun signIn( | ||
userName: String, | ||
password: String, | ||
): SignInModel | ||
|
||
fun checkIfAuthorized(): Boolean | ||
|
||
fun saveUserName(userName: String) | ||
|
||
suspend fun logOut(): LogOutModel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/src/main/java/by/alexandr7035/affinidi_id/data/ResetPasswordRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package by.alexandr7035.affinidi_id.data | ||
|
||
import by.alexandr7035.affinidi_id.data.model.reset_password.ConfirmPasswordResetModel | ||
import by.alexandr7035.affinidi_id.data.model.reset_password.InitializePasswordResetModel | ||
|
||
interface ResetPasswordRepository { | ||
suspend fun initializePasswordReset(userName: String): InitializePasswordResetModel | ||
|
||
suspend fun confirmResetPassword(userName: String, newPassword: String, confirmationCode: String): ConfirmPasswordResetModel | ||
} |
9 changes: 9 additions & 0 deletions
9
...rc/main/java/by/alexandr7035/affinidi_id/data/helpers/validation/InputValidationHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package by.alexandr7035.affinidi_id.data.helpers.validation | ||
|
||
interface InputValidationHelper { | ||
fun validateUserName(userName: String): InputValidationResult | ||
|
||
fun validatePassword(password: String): InputValidationResult | ||
|
||
fun validateConfirmationCode(confirmationCode: String): InputValidationResult | ||
} |
31 changes: 31 additions & 0 deletions
31
...ain/java/by/alexandr7035/affinidi_id/data/helpers/validation/InputValidationHelperImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package by.alexandr7035.affinidi_id.data.helpers.validation | ||
|
||
import android.util.Patterns | ||
|
||
class InputValidationHelperImpl(minPasswordLength: Int): InputValidationHelper { | ||
|
||
private val passwordPattern = "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).{$minPasswordLength,}\$".toPattern() | ||
|
||
override fun validateUserName(userName: String): InputValidationResult { | ||
return when { | ||
userName.isBlank() -> InputValidationResult.EMPTY_FIELD | ||
! Patterns.EMAIL_ADDRESS.matcher(userName).matches() -> InputValidationResult.WRONG_FORMAT | ||
else -> InputValidationResult.NO_ERRORS | ||
} | ||
} | ||
|
||
override fun validatePassword(password: String): InputValidationResult { | ||
return when { | ||
password.isBlank() -> InputValidationResult.EMPTY_FIELD | ||
! passwordPattern.matcher(password).matches() -> InputValidationResult.WRONG_FORMAT | ||
else -> InputValidationResult.NO_ERRORS | ||
} | ||
} | ||
|
||
override fun validateConfirmationCode(confirmationCode: String): InputValidationResult { | ||
return when { | ||
confirmationCode.isBlank() -> InputValidationResult.EMPTY_FIELD | ||
else -> InputValidationResult.NO_ERRORS | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...rc/main/java/by/alexandr7035/affinidi_id/data/helpers/validation/InputValidationResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package by.alexandr7035.affinidi_id.data.helpers.validation | ||
|
||
enum class InputValidationResult { | ||
EMPTY_FIELD, | ||
WRONG_FORMAT, | ||
NO_ERRORS | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.