Add docs for user settings.

master
Manager Bot 3 years ago
parent 087b35f1ff
commit 7aa0ac6f43
  1. 27
      Web/lib/MJB/Web/Controller/UserSettings.pm

@ -1,12 +1,24 @@
package MJB::Web::Controller::UserSettings; package MJB::Web::Controller::UserSettings;
use Mojo::Base 'Mojolicious::Controller', -signatures; use Mojo::Base 'Mojolicious::Controller', -signatures;
#==
# GET /profile | show_profile | templates/user_settings/profile.html.ep
#==
sub profile ( $c ) { sub profile ( $c ) {
# Set the form values from the DB if they don't exist from the POST handler. # Set the form values from the DB if they don't exist from the POST handler.
$c->stash->{form}->{name} ||= $c->stash->{person}->name; $c->stash->{form}->{name} ||= $c->stash->{person}->name;
$c->stash->{form}->{email} ||= $c->stash->{person}->email; $c->stash->{form}->{email} ||= $c->stash->{person}->email;
} }
#==
# POST /profile | do_profile
# name | The value to set for the account name
# email | The value to set for the account email
# password | The current password, used to authenticate this request.
#
# This route will change the user's name or email address. They are required
# to submit their current password to make these changes.
#==
sub do_profile ( $c ) { sub do_profile ( $c ) {
my $name = $c->stash->{form}->{name} = $c->param('name'); my $name = $c->stash->{form}->{name} = $c->param('name');
my $email = $c->stash->{form}->{email} = $c->param('email'); my $email = $c->stash->{form}->{email} = $c->param('email');
@ -38,8 +50,21 @@ sub do_profile ( $c ) {
$c->redirect_to( $c->url_for( 'show_profile' ) ); $c->redirect_to( $c->url_for( 'show_profile' ) );
} }
sub change_password ( $c ) { } #==
# GET /change_password | show_change_password | templates/user_settings/change_password.html.ep
#==
sub change_password ( $c ) {
}
#==
# POST /change_password | do_change_password
# password | The current password, used to authenticate this request.
# new_password | The new password to set for the account.
# password_confirm | Confirmation of the new password, it must match.
#
# This route will update the user's password.
#==
sub do_change_password ( $c ) { sub do_change_password ( $c ) {
# Get the values the user gave for the password change. # Get the values the user gave for the password change.
my $password = $c->stash->{form}->{password} = $c->param('password'); my $password = $c->stash->{form}->{password} = $c->param('password');

Loading…
Cancel
Save