aboutsummaryrefslogtreecommitdiff
path: root/src/actions/mixins/auth/test_backdoor.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/mixins/auth/test_backdoor.cr')
-rw-r--r--src/actions/mixins/auth/test_backdoor.cr13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/actions/mixins/auth/test_backdoor.cr b/src/actions/mixins/auth/test_backdoor.cr
new file mode 100644
index 0000000..68c9d91
--- /dev/null
+++ b/src/actions/mixins/auth/test_backdoor.cr
@@ -0,0 +1,13 @@
+module Auth::TestBackdoor
+ macro included
+ before test_backdoor
+ end
+
+ private def test_backdoor
+ if LuckyEnv.test? && (user_id = params.get?(:backdoor_user_id))
+ user = UserQuery.find(user_id)
+ sign_in user
+ end
+ continue
+ end
+end