Plugin/Users.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« Helper/Users/Login.pm ↑ Summary
1 package Daje::Plugin::Users;
2 0 ▶use Mojo::Base 'Mojolicious::Plugin', -base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=2.6
3 use v5.42;
4  
5 # NAME
6 # ====
7 #
8 # Daje::Plugin::Users - Mojolicious Plugin
9 #
10 # SYNOPSIS
11 # ========
12 #
13 # Mojolicious
14 # ===========
15 #
16 # $self->plugin('Users');
17 #
18 # Mojolicious::Lite
19 # =================
20 #
21 # plugin 'Users';
22 #
23 # DESCRIPTION
24 # ===========
25 #
26 # Daje::Plugin::Users is a Mojolicious plugin.
27 #
28 # METHODS
29 # =======
30 #
31 # Daje::Plugin::Users inherits all methods from
32 # Mojolicious::Plugin and implements the following new ones.
33 #
34 # register
35 # ========
36 # $plugin->register(Mojolicious->new);
37 #
38 # Register plugin in L<Mojolicious> application.
39 #
40 # SEE ALSO
41 # ========
42 #
43 # Mojolicious, Mojolicious::Guides, https://mojolicious.org.
44 #
45 # LICENSE
46 # =======
47 #
48 # Copyright (C) janeskil1525.
49 #
50 # This library is free software; you can redistribute it and/or modify
51 # it under the same terms as Perl itself.
52 #
53 # AUTHOR
54 # ======
55 #
56 # janeskil1525 E<lt>janeskil1525@gmail.com
57 #
58  
59 # This file is generated once automatically by Daje Tools 2026-01-17 11:42:23.
60 # It will not be touched by Daje Tools again.
61  
62 # <!-- Autogenerated file 2026-01-17 11:42:23 -->
63  
64 use Daje::Plugin::Users::Routes;
65 use Daje::Plugin::Users::Helpers;
66 use Daje::Database::Migrator;
67 use Daje::Helper::Users::Login;
68 use Daje::Plugin::Users::Authorities;
69 use Daje::Plugin::Users::Languages;
70 use Data::Dumper;
71  
72 our $VERSION = '0.04';
73  
74 sub register ($self, $app, $config) {
75 $app->log->debug("Daje::Plugin::Users::register start");
76  
77 my $migration->{class} = 'Daje::Database::Users';
78 $migration->{name} = 'users';
79 $migration->{migration} = 1;
80 my $migrations;
81 push @{$migrations}, $migration;
82 try {
83 Daje::Database::Migrator->new(
84 pg => $app->pg,
85 migrations => $migrations,
86 )->migrate();
87 } catch ($e) {
88 $app->log->error($e);
89 };
90  
91 my $r = $app->routes();
92  
93 $r->put($app->config->{project} . '/login')->to('Login#login_user');
94 $r->put($app->config->{project} . '/new/client/signup')->to('Login#signup');
95  
96 $app->auth->put('check_verify/')->to('Login#check_verify');
97 $app->auth->put('verify/')->to('Login#verify');
98 $app->auth->put('post_login/')->to('Login#post_login');
99  
100 $app->helper(
101 login => sub {
102 state $login = Daje::Helper::Users::Login->new(
103 db => $app->pg->db,
104 config => $app->config
105 )
106 }
107 );
108  
109 Daje::Plugin::Users::Routes->new()->routes($app, $config);
110 Daje::Plugin::Users::Helpers->new()->helpers($app, $config);
111 Daje::Plugin::Users::Authorities->new(
112 db => $app->pg->db
113 )->authorize();
114  
115 Daje::Plugin::Users::Languages->new(
116 db => $app->pg->db
117 )->language();
118  
119 $app->log->debug("Daje::Plugin::Users::register ends");
120 }
121  
122 1;
123  
124  
125  
126 #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
127  
128 =head1 NAME
129  
130  
131 Daje::Plugin::Users - Mojolicious Plugin
132  
133  
134  
135 =head1 SYNOPSIS
136  
137  
138  
139  
140 =head1 DESCRIPTION
141  
142  
143 Daje::Plugin::Users is a Mojolicious plugin.
144  
145  
146  
147 =head1 REQUIRES
148  
149 L<Daje::Database::Migrator>
150  
151 L<Daje::Plugin::Users::Helpers>
152  
153 L<Daje::Plugin::Users::Routes>
154  
155 L<v5.42>
156  
157 L<Mojo::Base>
158  
159  
160 =head1 METHODS
161  
162  
163 Daje::Plugin::Users inherits all methods from
164 Mojolicious::Plugin and implements the following new ones.
165  
166  
167  
168 =head1 Mojolicious::Lite
169  
170  
171 plugin 'Users';
172  
173  
174  
175 =head1 register
176  
177 $plugin->register(Mojolicious->new);
178  
179 Register plugin in L<Mojolicious> application.
180  
181  
182  
183 =head1 Mojolicious
184  
185  
186 $self->plugin('Users');
187  
188  
189  
190 =head1 SEE ALSO
191  
192  
193 Mojolicious, Mojolicious::Guides, https://mojolicious.org.
194  
195  
196  
197 =head1 AUTHOR
198  
199  
200 janeskil1525 E<lt>janeskil1525@gmail.com
201  
202  
203  
204 =head1 LICENSE
205  
206  
207 Copyright (C) janeskil1525.
208  
209 This library is free software; you can redistribute it and/or modify
210 it under the same terms as Perl itself.
211  
212  
213  
214 =cut
215  
« Helper/Users/Login.pm ↑ Summary