Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit 536afb7

Browse files
Merge pull request #122 from nodes-vapor/feature/misc-fixes
Feature/misc fixes
2 parents be6b9ef + 58780d6 commit 536afb7

23 files changed

+272
-216
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ version: 2
22
jobs:
33
MacOS:
44
macos:
5-
xcode: "9.3.0"
5+
xcode: "10.0.0"
66
steps:
77
- checkout
88
- restore_cache:
99
keys:
10-
- v3-spm-deps-{{ checksum "Package.swift" }}
10+
- v1-spm-deps-{{ checksum "Package.swift" }}
1111
- run:
1212
name: Install CMySQL and CTLS
1313
command: |
@@ -31,12 +31,12 @@ jobs:
3131
- .build
3232
Linux:
3333
docker:
34-
- image: nodesvapor/vapor-ci:swift-4.1
34+
- image: nodesvapor/vapor-ci:swift-4.2
3535
steps:
3636
- checkout
3737
- restore_cache:
3838
keys:
39-
- v4-spm-deps-{{ checksum "Package.swift" }}
39+
- v2-spm-deps-{{ checksum "Package.swift" }}
4040
- run:
4141
name: Copy Package file
4242
command: cp Package.swift res

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ identifier_name:
88
line_length: 100
99
disabled_rules:
1010
- opening_brace
11+
- nesting
1112
colon:
1213
flexible_right_spacing: true

Package.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:4.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -17,11 +17,12 @@ let package = Package(
1717
.package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
1818
.package(url: "https://github.com/vapor/auth.git", from: "2.0.0"),
1919

20-
.package(url: "https://github.com/nodes-vapor/sugar.git", from: "3.0.0-beta"),
20+
.package(url: "https://github.com/nodes-vapor/sugar.git", from: "3.0.0-rc"),
2121
.package(url: "https://github.com/nodes-vapor/flash.git", from: "3.0.0"),
2222
.package(url: "https://github.com/nodes-vapor/bootstrap.git", from: "2.0.0"),
23-
.package(url: "https://github.com/nodes-vapor/reset.git", from: "1.0.0-beta"),
23+
.package(url: "https://github.com/nodes-vapor/reset.git", from: "1.0.0-rc"),
2424
.package(url: "https://github.com/nodes-vapor/submissions.git", from: "1.0.0-beta"),
25+
.package(url: "https://github.com/nodes-vapor/paginator.git", from: "3.0.0-rc"),
2526

2627
.package(url: "https://github.com/twof/VaporMailgunService.git", from: "1.1.0"),
2728
],
@@ -39,7 +40,8 @@ let package = Package(
3940
"Bootstrap",
4041
"Reset",
4142
"Submissions",
42-
"Mailgun"
43+
"Mailgun",
44+
"Paginator"
4345
]),
4446
.testTarget(
4547
name: "AdminPanelTests",

Resources/Views/AdminPanel/AdminPanelUser/edit.leaf

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,18 @@
4141
#if(user == nil) {
4242
<p>If you don't specify a password, then the user will receive an email with instructions on how to set one. If you specify a password, then no email will be sent to the new user.</p>
4343

44-
<div class="form-group form-check">
45-
<input type="checkbox" class="form-check-input" id="shouldSpecifyPassword" name="shouldSpecifyPassword" aria-describedby="shouldSpecifyPasswordHelp" value="1">
46-
<label class="form-check-label" for="shouldSpecifyPassword">Specify password</label>
47-
<small id="shouldSpecifyPasswordHelp" class="form-text text-muted">Leave this out and the user will have to specify one themselves.</small>
44+
#submissions:checkbox("shouldSpecifyPassword", "Specify password", "Leave this out and the user will have to specify one themselves.")
45+
46+
<div id="specifyPassword" style="display:none;">
47+
#submissions:password("password", "Enter password", "Minimum 8 characters and needs to satisfy three of the following: has a lowercase character, has an uppercase character, has a digit or has a special character.")
48+
#submissions:password("passwordAgain", "Enter password again")
4849
</div>
49-
}
5050

51-
<div id="specifyPassword" style="#if(user == nil) { display:none; }">
51+
#submissions:checkbox("shouldResetPassword", "Should reset password", "This will require the user to set a new password after logging in the first time.")
52+
} else {
5253
#submissions:password("password", "Enter password", "Minimum 8 characters.")
5354
#submissions:password("passwordAgain", "Enter password again")
54-
55-
#if(user == nil) {
56-
<div class="form-group form-check">
57-
<input type="checkbox" class="form-check-input" id="shouldResetPassword" name="shouldResetPassword" aria-describedby="shouldResetPasswordHelp" value="1">
58-
<label class="form-check-label" for="shouldResetPassword">Should reset password</label>
59-
<small id="shouldResetPasswordHelp" class="form-text text-muted">This will require the user to set a new password after logging in the first time.</small>
60-
</div>
61-
}
62-
</div>
55+
}
6356

6457
<button type="submit" class="btn btn-primary">Submit</button>
6558
<a href="/admin/users" class="btn btn-secondary">Cancel</a>
@@ -85,10 +78,18 @@
8578

8679
// Password toggle
8780
$(function () {
88-
$("#shouldSpecifyPassword").click(function(){
81+
$("#specifyPassword").toggle($("#shouldSpecifyPassword").prop("checked"));
82+
$("#shouldSpecifyPassword").click(function() {
83+
if (!this.checked) {
84+
$("#password").val("");
85+
$("#passwordAgain").val("");
86+
\}
87+
88+
$("#password").prop('required', (this.checked))
89+
$("#passwordAgain").prop('required', (this.checked))
90+
8991
$("#specifyPassword").toggle();
9092
\});
91-
9293
\});
9394
</script>
9495
}

Resources/Views/AdminPanel/AdminPanelUser/index.leaf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
}
3939
</tbody>
4040
</table>
41+
42+
#offsetPaginator()
4143
}
4244

4345
#embed("AdminPanel/Layout/base")

Resources/Views/AdminPanel/Layout/Partials/sitetitle.leaf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="/admin/dashboard">
1+
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="/admin">
22
#adminPanel:config("name")
33
#if(adminPanel:config("environment") != "production") {
44
<span class="badge badge-primary">#adminPanel:config("environment")</span>

Resources/Views/AdminPanel/Login/request-reset-password.leaf

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
#embed("AdminPanel/Layout/Partials/alerts")
1414

15-
<div class="form-group">
16-
<label for="email">Email address</label>
17-
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email" required autofocus>
18-
</div>
15+
#submissions:email("email", "Enter email")
1916

2017
<div class="form-row">
2118
<div class="col">
@@ -27,8 +24,6 @@
2724
<a href="/admin/login" class="btn btn-lg btn-block btn-secondary">Cancel</a>
2825
</div>
2926
</div>
30-
31-
<p class="mt-5 mb-3 text-muted version">Admin Panel ✍️ by <a href="https://github.com/nodes-vapor/" target="_blank">Vapor at Nodes</a></p>
3227
</form>
3328
}
3429

Resources/Views/AdminPanel/Login/reset-password.leaf

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,8 @@
1111

1212
#embed("AdminPanel/Layout/Partials/alerts")
1313

14-
<div class="form-group">
15-
<label for="password">New password</label>
16-
<input type="password" id="password" name="password" class="form-control" placeholder="Enter password" required autofocus>
17-
</div>
18-
19-
<div class="form-group">
20-
<label for="passwordAgain">New password again</label>
21-
<input type="password" id="passwordAgain" name="passwordAgain" class="form-control" placeholder="Enter password again" required autofocus>
22-
</div>
14+
#submissions:password("password", "Enter password", "Minimum 8 characters and needs to satisfy three of the following: has a lowercase character, has an uppercase character, has a digit or has a special character.")
15+
#submissions:password("passwordAgain", "Enter password again")
2316

2417
<div class="form-row">
2518
<div class="col">
@@ -31,8 +24,6 @@
3124
<a href="/admin/login" class="btn btn-lg btn-block btn-secondary">Cancel</a>
3225
</div>
3326
</div>
34-
35-
<p class="mt-5 mb-3 text-muted version">Admin Panel ✍️ by <a href="https://github.com/nodes-vapor/" target="_blank">Vapor at Nodes</a></p>
3627
</form>
3728
}
3829

Sources/AdminPanel/Commands/AdminPanelUser+Seedable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension AdminPanelUser: Seedable {
3333
short: "n",
3434
default: AdminPanelUser.defaultName,
3535
help: ["Change name"]
36-
),
36+
)
3737
]
3838
}
3939

Sources/AdminPanel/Configs/AdminPanelConfig.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public struct AdminPanelConfig<U: AdminPanelUserType>: Service {
3434
public let controllers: AdminPanelControllers<U>
3535
public let sidebarMenuPathGenerator: SidebarMenuPathGenerator<U.Role>
3636
public let resetPasswordEmail: ResetPasswordEmail
37+
public let resetPasswordSignerKey: LosslessDataConvertible
3738
public let specifyPasswordEmail: SpecifyPasswordEmail
3839
public let newUserSetPasswordSigner: ExpireableJWTSigner
3940
public let environment: Environment
@@ -45,8 +46,10 @@ public struct AdminPanelConfig<U: AdminPanelUserType>: Service {
4546
endpoints: AdminPanelEndpoints = .default,
4647
views: AdminPanelViews = .default,
4748
controllers: AdminPanelControllers<U> = .default,
48-
sidebarMenuPathGenerator: @escaping SidebarMenuPathGenerator<U.Role> = U.Role.sidebarMenuPathGenerator,
49+
sidebarMenuPathGenerator: @escaping SidebarMenuPathGenerator<U.Role>
50+
= U.Role.sidebarMenuPathGenerator,
4951
resetPasswordEmail: ResetPasswordEmail = .default,
52+
resetPasswordSignerKey: LosslessDataConvertible,
5053
specifyPasswordEmail: SpecifyPasswordEmail = .default,
5154
newUserSetPasswordSigner: ExpireableJWTSigner,
5255
environment: Environment,
@@ -59,6 +62,7 @@ public struct AdminPanelConfig<U: AdminPanelUserType>: Service {
5962
self.controllers = controllers
6063
self.sidebarMenuPathGenerator = sidebarMenuPathGenerator
6164
self.resetPasswordEmail = resetPasswordEmail
65+
self.resetPasswordSignerKey = resetPasswordSignerKey
6266
self.specifyPasswordEmail = specifyPasswordEmail
6367
self.newUserSetPasswordSigner = newUserSetPasswordSigner
6468
self.environment = environment

0 commit comments

Comments
 (0)