-
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.
- Loading branch information
Showing
16 changed files
with
1,630 additions
and
29 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
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
208 changes: 208 additions & 0 deletions
208
springboot/api/src/main/kotlin/webapp/users/signup/Account.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,208 @@ | ||
//@file:Suppress("unused") | ||
// | ||
//package webapp.users.signup | ||
// | ||
//import jakarta.validation.constraints.Email | ||
//import jakarta.validation.constraints.NotBlank | ||
//import jakarta.validation.constraints.Pattern | ||
//import jakarta.validation.constraints.Size | ||
//import org.springframework.web.server.ServerWebExchange | ||
//import webapp.core.http.validator | ||
//import java.time.Instant | ||
//import java.util.* | ||
// | ||
///** | ||
// * Représente l'account domain model sans le password | ||
// */ | ||
////TODO: add field enabled=false | ||
//data class Account( | ||
// val id: UUID? = null, | ||
// @field:NotBlank | ||
// @field:Pattern(regexp = LOGIN_REGEX) | ||
// @field:Size(min = 1, max = 50) | ||
// val login: String? = null, | ||
// @field:Size(max = 50) | ||
// val firstName: String? = null, | ||
// @field:Size(max = 50) | ||
// val lastName: String? = null, | ||
// @field:Email | ||
// @field:Size(min = 5, max = 254) | ||
// val email: String? = null, | ||
// @field:Size(max = 256) | ||
// val imageUrl: String? = IMAGE_URL_DEFAULT, | ||
// val activated: Boolean = false, | ||
// @field:Size(min = 2, max = 10) | ||
// val langKey: String? = null, | ||
// val createdBy: String? = null, | ||
// val createdDate: Instant? = null, | ||
// val lastModifiedBy: String? = null, | ||
// val lastModifiedDate: Instant? = null, | ||
// val authorities: Set<String>? = null | ||
//){ | ||
// companion object { | ||
// const val IMAGE_URL_DEFAULT = "http://placehold.it/50x50" | ||
// // Regex for acceptable logins | ||
// const val LOGIN_REGEX = | ||
// "^(?>[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)|(?>[_.@A-Za-z0-9-]+)$" | ||
// const val PASSWORD_MIN: Int = 4 | ||
// const val PASSWORD_MAX: Int = 16 | ||
// @JvmStatic | ||
// val objectName: String = Account::class | ||
// .java | ||
// .simpleName | ||
// .run { | ||
// replaceFirst( | ||
// first(), | ||
// first().lowercaseChar() | ||
// ) | ||
// } | ||
// const val LOGIN_FIELD = "login" | ||
// const val PASSWORD_FIELD = "password" | ||
// const val EMAIL_FIELD = "email" | ||
// const val ACCOUNT_AUTH_USER_ID_FIELD = "userId" | ||
// const val ACTIVATION_KEY_FIELD = "activationKey" | ||
// const val RESET_KEY_FIELD = "resetKey" | ||
// const val FIRST_NAME_FIELD = "firstName" | ||
// const val LAST_NAME_FIELD = "lastName" | ||
// } | ||
//} | ||
// | ||
//fun Account.isActivated(): Boolean = activated | ||
// | ||
//fun Account.validate( | ||
// fields: Set<String>, | ||
// //si le validateur est null alors injecter celui du context | ||
// // mais faire cela a l'appel de la methode validate | ||
// //faire une extension function getValidator(exchange: ServerWebExchange?=null) | ||
// exchange: ServerWebExchange?, //Pair<ApplicationContext,ServerWebExchange> | ||
// //si les deux sont null contruire soit meme le validator par defaut | ||
//) = exchange.apply { | ||
// if (this == null) return emptySet<Map<String, String>>() | ||
//}!!.validator.run { | ||
// fields.map { field -> | ||
// field to validateProperty(this@validate, field) | ||
// }.flatMap { violatedField -> | ||
// violatedField.second.map { | ||
// mapOf( | ||
// "objectName" to Account.objectName, | ||
// "field" to violatedField.first, | ||
// "message" to it.message | ||
// ) | ||
// } | ||
// }.toSet() | ||
//} | ||
// | ||
////fun Account.validate( | ||
//// fields: Set<String>, | ||
//// //si le validateur est null alors injecter celui du context | ||
//// // mais faire cela a l'appel de la methode validate | ||
//// //faire une extension function getValidator(exchange: ServerWebExchange?=null) | ||
//// exchange: ServerWebExchange?, //Pair<ApplicationContext,ServerWebExchange> | ||
//// //si les deux sont null contruire soit meme le validator par defaut | ||
////) = exchange.apply { | ||
//// if (this == null) return emptySet<Map<String, String>>() | ||
////}!!.validator.run { | ||
//// fields.map { field -> | ||
//// field to validateProperty(this@validate, field) | ||
//// }.flatMap { violatedField -> | ||
//// violatedField.second.map { | ||
//// mapOf( | ||
//// "objectName" to Account.objectName, | ||
//// "field" to violatedField.first, | ||
//// "message" to it.message | ||
//// ) | ||
//// } | ||
//// }.toSet() | ||
////} | ||
// | ||
// | ||
////@file:Suppress("unused") | ||
//// | ||
////package community.accounts | ||
//// | ||
////import community.core.http.validator | ||
////import jakarta.validation.constraints.Email | ||
////import jakarta.validation.constraints.NotBlank | ||
////import jakarta.validation.constraints.Pattern | ||
////import jakarta.validation.constraints.Size | ||
////import org.springframework.web.server.ServerWebExchange | ||
////import java.time.Instant | ||
////import java.util.* | ||
//// | ||
/////** | ||
//// * Représente l'account domain model avec le password et l'activationKey | ||
//// * pour la vue | ||
//// */ | ||
////data class Account( | ||
//// val id: UUID? = null, | ||
//// @field:NotBlank | ||
//// @field:Pattern(regexp = LOGIN_REGEX) | ||
//// @field:Size(min = 1, max = 50) | ||
//// val login: String? = null, | ||
//// @field:Email | ||
//// @field:Size(min = 5, max = 254) | ||
//// val email: String? = null, | ||
//// @field:Size(max = 50) | ||
//// val firstName: String? = null, | ||
//// @field:Size(max = 50) | ||
//// val lastName: String? = null, | ||
//// @field:Size(min = 2, max = 10) | ||
//// val langKey: String? = null, | ||
//// @field:Size(max = 256) | ||
//// val imageUrl: String? = IMAGE_URL_DEFAULT, | ||
//// val createdBy: String? = null, | ||
//// val createdDate: Instant? = null, | ||
//// val lastModifiedBy: String? = null, | ||
//// val lastModifiedDate: Instant? = null, | ||
//// val authorities: Set<String>? = null | ||
////) { | ||
//// companion object { | ||
//// const val IMAGE_URL_DEFAULT = "http://placehold.it/50x50" | ||
//// // Regex for acceptable logins | ||
//// const val LOGIN_REGEX = | ||
//// "^(?>[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)|(?>[_.@A-Za-z0-9-]+)$" | ||
//// const val PASSWORD_MIN: Int = 4 | ||
//// const val PASSWORD_MAX: Int = 16 | ||
//// @JvmStatic | ||
//// val objectName: String = Account::class | ||
//// .java | ||
//// .simpleName | ||
//// .run { | ||
//// replaceFirst( | ||
//// first(), | ||
//// first().lowercaseChar() | ||
//// ) | ||
//// } | ||
//// const val LOGIN_FIELD = "login" | ||
//// const val PASSWORD_FIELD = "password" | ||
//// const val EMAIL_FIELD = "email" | ||
//// const val ACCOUNT_AUTH_USER_ID_FIELD = "userId" | ||
//// const val ACTIVATION_KEY_FIELD = "activationKey" | ||
//// const val RESET_KEY_FIELD = "resetKey" | ||
//// const val FIRST_NAME_FIELD = "firstName" | ||
//// const val LAST_NAME_FIELD = "lastName" | ||
//// } | ||
////} | ||
//// | ||
////fun Account.validate( | ||
//// fields: Set<String>, | ||
//// //si le validateur est null alors injecter celui du context | ||
//// // mais faire cela a l'appel de la methode validate | ||
//// //faire une extension function getValidator(exchange: ServerWebExchange?=null) | ||
//// exchange: ServerWebExchange?, //Pair<ApplicationContext,ServerWebExchange> | ||
//// //si les deux sont null contruire soit meme le validator par defaut | ||
////) = exchange.apply { | ||
//// if (this == null) return emptySet<Map<String, String>>() | ||
////}!!.validator.run { | ||
//// fields.map { field -> | ||
//// field to validateProperty(this@validate, field) | ||
//// }.flatMap { violatedField -> | ||
//// violatedField.second.map { | ||
//// mapOf( | ||
//// "objectName" to Account.objectName, | ||
//// "field" to violatedField.first, | ||
//// "message" to it.message | ||
//// ) | ||
//// } | ||
//// }.toSet() | ||
////} |
85 changes: 85 additions & 0 deletions
85
springboot/api/src/main/kotlin/webapp/users/signup/AccountCredentials.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,85 @@ | ||
//@file:Suppress("unused") | ||
// | ||
//package webapp.users.signup | ||
// | ||
//import jakarta.validation.constraints.* | ||
//import webapp.core.property.IMAGE_URL_DEFAULT | ||
//import webapp.core.property.LOGIN_REGEX | ||
//import webapp.core.property.PASSWORD_MAX | ||
//import webapp.core.property.PASSWORD_MIN | ||
//import webapp.accounts.models.AccountUtils.objectName | ||
//import java.time.Instant | ||
//import java.util.* | ||
// | ||
///** | ||
// * Représente l'account domain model avec le password et l'activationKey | ||
// * pour la vue | ||
// */ | ||
//data class AccountCredentials( | ||
// val id: UUID? = null, | ||
// @field:Size(min = PASSWORD_MIN, max = PASSWORD_MAX) | ||
// @field:NotNull | ||
// val password: String? = null, | ||
// @field:NotBlank | ||
// @field:Pattern(regexp = LOGIN_REGEX) | ||
// @field:Size(min = 1, max = 50) | ||
// val login: String? = null, | ||
// @field:Email | ||
// @field:Size(min = 5, max = 254) | ||
// val email: String? = null, | ||
// @field:Size(max = 50) | ||
// val firstName: String? = null, | ||
// @field:Size(max = 50) | ||
// val lastName: String? = null, | ||
// @field:Size(min = 2, max = 10) | ||
// val langKey: String? = null, | ||
// @field:Size(max = 256) | ||
// val imageUrl: String? = IMAGE_URL_DEFAULT, | ||
// val activationKey: String? = null, | ||
// val resetKey: String? = null, | ||
// val activated: Boolean = false, | ||
// val createdBy: String? = null, | ||
// val createdDate: Instant? = null, | ||
// val lastModifiedBy: String? = null, | ||
// val lastModifiedDate: Instant? = null, | ||
// val authorities: Set<String>? = null | ||
//) { | ||
// | ||
// constructor(account: Account) : this( | ||
// id = account.id, | ||
// login = account.login, | ||
// email = account.email, | ||
// firstName = account.firstName, | ||
// lastName = account.lastName, | ||
// langKey = account.langKey, | ||
// activated = account.activated, | ||
// createdBy = account.createdBy, | ||
// createdDate = account.createdDate, | ||
// lastModifiedBy = account.lastModifiedBy, | ||
// lastModifiedDate = account.lastModifiedDate, | ||
// imageUrl = account.imageUrl, | ||
// authorities = account.authorities?.map { it }?.toMutableSet() | ||
// ) | ||
// | ||
// companion object { | ||
// @JvmStatic | ||
// val objectName = AccountCredentials::class.java.simpleName.objectName | ||
// } | ||
//} | ||
// | ||
// | ||
//fun AccountCredentials.toAccount(): Account = Account( | ||
// id = id, | ||
// login = login, | ||
// firstName = firstName, | ||
// lastName = lastName, | ||
// email = email, | ||
// activated = activated, | ||
// langKey = langKey, | ||
// createdBy = createdBy, | ||
// createdDate = createdDate, | ||
// lastModifiedBy = lastModifiedBy, | ||
// lastModifiedDate = lastModifiedDate, | ||
// authorities = authorities | ||
//) | ||
// |
17 changes: 17 additions & 0 deletions
17
springboot/api/src/main/kotlin/webapp/users/signup/AccountExtra.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 webapp.users.signup | ||
// | ||
//import java.time.Instant | ||
//import java.util.* | ||
// | ||
//data class AccountExtra( | ||
// val password: String, | ||
// val enabled: Boolean = false, | ||
// val activationKey: String?, | ||
// val resetKey: String? = null, | ||
// val resetDate: Instant? = null, | ||
// val createdBy: UUID, | ||
// val lastModifiedBy: UUID, | ||
//) | ||
// | ||
// | ||
// |
7 changes: 7 additions & 0 deletions
7
springboot/api/src/main/kotlin/webapp/users/signup/AccountFull.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 webapp.users.signup | ||
// | ||
//data class AccountFull( | ||
// val account: Account, | ||
// val accountExtra: AccountExtra, | ||
//) | ||
// |
17 changes: 0 additions & 17 deletions
17
springboot/api/src/main/kotlin/webapp/users/signup/AccountRestApis.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.