| 1 | #!/usr/bin/env perl | ||||||||||
| 2 | 1 | ▶ | use v5.24; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Yukki; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Yukki::TextUtil qw( prompt dump_file load_file ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | my $app = Yukki->new; | |||||||||
| 9 | |||||||||||
| 10 | 1 | my $username = prompt 'Login name:'; | |||||||||
| 11 | |||||||||||
| 12 | 1 | my $user = $app->model('User')->find(login_name => $username); | |||||||||
| 13 | 1 | ▶ | if (not defined $user) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | die "User $username does not exist. Please create this user before setting the password.\n"; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 1 | my $password = prompt 'Password:', -echo => '', -v; | |||||||||
| 18 | |||||||||||
| 19 | 1 | $app->model('User')->set_password($user, $password); | |||||||||
| 20 | 1 | $app->model('User')->save($user); | |||||||||
| 21 | |||||||||||
| 22 | # ABSTRACT: set the password for a user | ||||||||||
| 23 | # PODNAME: yukki-passwd | ||||||||||
| 24 | |||||||||||
| 25 | __END__ | ||||||||||
| 26 | |||||||||||
| 27 | =pod | ||||||||||
| 28 | |||||||||||
| 29 | =encoding UTF-8 | ||||||||||
| 30 | |||||||||||
| 31 | =head1 NAME | ||||||||||
| 32 | |||||||||||
| 33 | yukki-passwd - set the password for a user | ||||||||||
| 34 | |||||||||||
| 35 | =head1 VERSION | ||||||||||
| 36 | |||||||||||
| 37 | version 0.991_002 | ||||||||||
| 38 | |||||||||||
| 39 | =head1 SYNOPSIS | ||||||||||
| 40 | |||||||||||
| 41 | yukki-passwd | ||||||||||
| 42 | |||||||||||
| 43 | =head1 DESCRIPTION | ||||||||||
| 44 | |||||||||||
| 45 | Interactively asks for login name and password to give a user. | ||||||||||
| 46 | |||||||||||
| 47 | =head1 ENVIRONMENT | ||||||||||
| 48 | |||||||||||
| 49 | Normally, this script tries to find F<etc/yukki.conf> from the current working | ||||||||||
| 50 | directory. If no configuraiton file is found, it checks C<YUKKI_CONFIG> for the | ||||||||||
| 51 | path to this file. | ||||||||||
| 52 | |||||||||||
| 53 | =head1 AUTHOR | ||||||||||
| 54 | |||||||||||
| 55 | Andrew Sterling Hanenkamp <hanenkamp@cpan.org> | ||||||||||
| 56 | |||||||||||
| 57 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 58 | |||||||||||
| 59 | This software is copyright (c) 2017 by Qubling Software LLC. | ||||||||||
| 60 | |||||||||||
| 61 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 62 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||