Hello ,

I would like to write Raw view model for current scenario,

i started writing portal for self service AD change password , the view for 
the change password is no need any model ,since it should be is using 
background ldap3 library , in addition i would like in a POST method to 
read the HTML name tag for current password and new password without need 
of form

i started to build the view class , but seems i am missing something, if 
someone can assist me will be appreciated.

Thanks

*view class*

class ChangeUserPassword(View):
    info_sended = False
    template_name = "changepassword.html"
    AUTH_SERVER = config('AUTH_SERVER')
    BASEDN = config('BASEDN')
    #form_class = UserChangePasswordForm
    #success_url = reverse_lazy('loader_success')

    def get(self, request):
        current_user = request.user
        context = {'form' : current_user}
        return render(request, self.template_name, context)

    def post(self, request):
        PassForm = ""
        #form = PassForm()
        if request.method == 'POST':
            form = PassForm(request.POST)

            if form.is_valid():
                current_user = request.user
                print(current_user)

*HTML form*

<div class="login-or">
            
          </div>
          
          <div class="form-group">
            
            <form id="login-nav" method="post" role="form" class="form" 
accept-charset="UTF-8">
            {% csrf_token %}


              <!-- Current-Password group -->
              <div class="form-group">

                <!-- Current-Password label -->
                <label class="sr-only">Current Password </label>
                <!-- Current-Password input -->
                <div class="input-group">
                  <input type="password" id="cuInput" class="form-control" 
data-placement="bottom" 
          data-toggle="popover" data-container="body" data-html="true" 
placeholder="Current Password" required>

                  <div class="input-group-append">
                    <button class="btn btn-outline-secondary" type="button" 
id="" onclick="CurrentPass()">
                      <i class="fa fa-eye" aria-hidden="true"></i>
                    </button>
                  </div>
                  
                </div>
                <!-- password-confirm error message -->
                <div class="help-block text-right">
                  <small><span id="" class="hide pull-right block-help">
                  <i class="fa fa-info-circle text-danger" aria-hidden=
"true"></i>Don't match password'</span></small>
                </div>

              </div>
              <hr class="hr-or">
              
            </div>
              <!-- password group -->
              <div class="form-group">
                
                <!-- password label -->
                <label class="sr-only">Password</label>
                <!-- password input -->
                <div class="input-group">
                  <input type="password" id="reg_userpassword" name=
"user_password" class="form-control" data-placement="bottom" data-toggle=
"popover" data-container="body"
          data-html="true" value="" placeholder="Password" required>

                  <div class="input-group-append">
                    <button class="btn btn-outline-secondary" type="button" 
id="button-append1" onclick="togglePassword()">
                      <i class="fa fa-eye" aria-hidden="true"></i>
                    </button>
                  </div>
                </div>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd394b13-c20a-4ca8-ada9-0f779b744019n%40googlegroups.com.

Reply via email to