WIP: Begins work on login / signup, adds user database models, authentication needs implemented.
This commit is contained in:
@@ -45,7 +45,7 @@ public struct Input: HTML, Sendable {
|
||||
.id(id ?? ""), .name(_name), .placeholder(placeholder),
|
||||
.class(
|
||||
"""
|
||||
w-full rounded-md bg-white px-3 py-1.5 text-slate-900 outline-1
|
||||
input w-full rounded-md bg-white px-3 py-1.5 text-slate-900 outline-1
|
||||
-outline-offset-1 outline-slate-300 focus:outline focus:-outline-offset-2
|
||||
focus:outline-indigo-600 invalid:border-red-500 out-of-range:border-red-500
|
||||
"""
|
||||
@@ -67,4 +67,30 @@ extension HTMLAttribute where Tag == HTMLTag.input {
|
||||
public static func step(_ value: String) -> Self {
|
||||
.init(name: "step", value: value)
|
||||
}
|
||||
|
||||
public static func minlength(_ value: String) -> Self {
|
||||
.init(name: "minlength", value: value)
|
||||
}
|
||||
|
||||
public static func pattern(value: String) -> Self {
|
||||
.init(name: "pattern", value: value)
|
||||
}
|
||||
|
||||
public static func pattern(_ type: PatternType) -> Self {
|
||||
pattern(value: type.value)
|
||||
}
|
||||
}
|
||||
|
||||
public enum PatternType: Sendable {
|
||||
case password
|
||||
case username
|
||||
|
||||
var value: String {
|
||||
switch self {
|
||||
case .password:
|
||||
return "(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
|
||||
case .username:
|
||||
return "[A-Za-z][A-Za-z0-9\\-]*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user