Handles the "change password" task -- both form display and validation.

        Uses the default auth views.
162180
def password_change(self, request):
        
        from django.contrib.auth.views import password_change
        url = reverse('admin:cms_password_change_done')
        defaults = {
            'post_change_redirect': url,
            'template_name': 'cms/password_change_form.html',
        }
        if self.password_change_template is not None:
            defaults['template_name'] = self.password_change_template
        return password_change(request, **defaults)
1273268
def clean_password(self, password, user=None):
        
        min_length = app_settings.PASSWORD_MIN_LENGTH
        if min_length and len(password) < min_length:
            raise forms.ValidationError(_("Password must be a minimum of {0} "
                                          "characters.").format(min_length))
        validate_password(password, user)
        return password
324743
protected function redirectToChangePassword()
    {
        // Since this form is loaded via an iframe, this redirect must be performed via javascript
        $changePasswordForm = ChangePasswordForm::create($this, 'ChangePasswordForm');
        $changePasswordForm->sessionMessage(
            _t('SilverStripe\\Security\\Member.PASSWORDEXPIRED', 'Your password has expired. Please choose a new one.'),
            'good'
        );

        // Get redirect url
        $changePasswordURL = $this->addBackURLParam(Security::singleton()->Link('changepassword'));
        $changePasswordURLATT = Convert::raw2att($changePasswordURL);
        $changePasswordURLJS = Convert::raw2js($changePasswordURL);
        $message = _t(
            'SilverStripe\\Security\\CMSMemberLoginForm.PASSWORDEXPIRED',
            '<p>Your password has expired. <a target="_top" href="{link}">Please choose a new one.</a></p>',
            'Message displayed to user if their session cannot be restored',
            array('link' => $changePasswordURLATT)
        );

        // Redirect to change password page
        $response = HTTPResponse::create()
            ->setBody(<<<PHP
<!DOCTYPE html>
<html><body>
$message
<script type="application/javascript">
setTimeout(function(){top.location.href = "$changePasswordURLJS";}, 0);
</script>
</body></html>
PHP
        );
        return $response;
    }
521399
public function update(ChangePasswordRequest $request, Guard $auth)
    {
        try {
            $this->dispatch(new ChangePassword($auth->user()->id, $request->get('current_password'), $request->get('new_password')));
            return redirect()->route('authentication::profile.show');
        } catch (ValidationException $e) {
            return redirect()->back()->withErrors($e->errors());
        }
    }
23907
def check_user_password(self, user, password=None, form=None):
        
        pwcol = self.options['password_column']
        if password is None:
            if not form and "form" in current_context.data and request.method == "POST":
                form = current_context.data.form
            if form:
                password = form[pwcol].data
            else:
                raise OptionMissingError("Missing 'password' option or a form")
        current_pwd = getattr(user, pwcol)
        if not current_pwd or not self.bcrypt.check_password_hash(current_pwd, password):
            current_context.exit(trigger_action_group="password_mismatch")
739833
function onConfirmPasswordReset() {
  var code = $('#password-reset-code').val();
  var password = $('#password-reset-password').val();
  auth.confirmPasswordReset(code, password).then(function() {
    alertSuccess('Password has been changed!');
  }, onAuthError);
}
290320
def password_change
    unless current_user
      bounce_user
      return
    end

    respond_to do |format|
      format.html do
        @credential = current_user.credentials.
                                   where(type:  'Credentials::Password').first
        unless @credential
          @credential = Credentials::Password.new
          @credential.user = current_user
        end
        # Renders session/password_change.html.erb
      end
    end
  end
204057
def show
    if @confirmable.new_record?  ||
       !::Milia.use_invite_member ||
       @confirmable.skip_confirm_change_password

      log_action( "devise pass-thru" )
      super  # this will redirect
      if @confirmable.skip_confirm_change_password
        sign_in_tenanted(resource)
      end
    else
      log_action( "password set form" )
      prep_do_show()  # prep for the form
    end
    # else fall thru to show template which is form to set a password
    # upon SUBMIT, processing will continue from update
  end
970375
private function changePassword($admin): void
    {
        $this->getPassword();

        $admin->password = bcrypt($this->password);
        $admin->save();

        $this->info('Password has been updated!');
        exit;
    }
430639
function showChangePasswordDialog(event) {
      $mdDialog.show({
        controller: 'EditPasswordController',
        controllerAs: 'password',
        templateUrl: 'app/admin/user/list/edit/edit-password/edit-password.html',
        targetEvent: event,
        locals: {user: vm.user},
        bindToController: true,
        clickOutsideToClose: false
      });
    }
100577
def reset_pw_confirm_view(request, uidb64=None, token=None):
    
    return password_reset_confirm(request,
        template_name="reset_confirmation.html",
        uidb64=uidb64, token=token, post_reset_redirect=reverse('login'))
23063
public function resetPassword()
    {
        $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
        $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
        $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
        $this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
    }
1147458
public function ChangePasswordForm()
    {
        $form = ChangePasswordForm::create($this, "ChangePasswordForm");

        $form
            ->Actions()
            ->find("name", "action_doChangePassword")
            ->addExtraClass("btn")
            ->addExtraClass("btn-green");

        $cancel_btn = LiteralField::create(
            "CancelLink",
            '<a href="' . $this->Link() . '" class="btn btn-red">'. _t("Users.CANCEL", "Cancel") .'</a>'
        );

        $form
            ->Actions()
            ->insertBefore($cancel_btn, "action_doChangePassword");

        $this->extend("updateChangePasswordForm", $form);

        return $form;
    }
397343
def change_password(ctx):
    """"""

    username, passhash = _get_credentials(ctx.obj['username'],
                                          ctx.obj['password'],
                                          ctx.obj['db'])

    change_user = ctx.obj['db'].objectmodels['user'].find_one({
        'name': username
    })
    if change_user is None:
        log('No such user', lvl=warn)
        return

    change_user.passhash = passhash
    change_user.save()

    log("Done")
1017956
def change_username_view(self):
        

        # Initialize form
        form = self.ChangeUsernameFormClass(request.form)

        # Process valid POST
        if request.method == 'POST' and form.validate():

            # Change username
            new_username = form.new_username.data
            current_user.username=new_username
            self.db_manager.save_object(current_user)
            self.db_manager.commit()

            # Send username_changed email
            self.email_manager.send_username_changed_email(current_user)

            # Send changed_username signal
            signals.user_changed_username.send(current_app._get_current_object(), user=current_user)

            # Flash a system message
            flash(_("Your username has been changed to '%(username)s'.", username=new_username), 'success')

            # Redirect to 'next' URL
            safe_next_url = self._get_safe_next_url('next', self.USER_AFTER_CHANGE_USERNAME_ENDPOINT)
            return redirect(safe_next_url)

        # Render form
        self.prepare_domain_translations()
        return render_template(self.USER_CHANGE_USERNAME_TEMPLATE, form=form)
624087
def on_model_change(self, form, User, is_created):
        """"""
        if form.password.data is not None:
            pwd_ctx = current_app.extensions['security'].pwd_context
            if pwd_ctx.identify(form.password.data) is None:
                User.password = hash_password(form.password.data)
151734
function changePassword(masterPassword, newPassword1, newPassword2) {
    if (newPassword1 !== newPassword2) throw new Error("New passwords must match.");
    else {
        var contents = getContents(masterPassword);
        init(newPassword1, contents);
    }
}