SHARE
TWEET

Untitled

a guest Jun 27th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def password(request):
  2.    if request.method == 'POST':
  3.    username = request.POST.get('username')
  4.    email = request.POST.get('email')
  5.    novasenha = request.POST.get('novasenha')
  6.  
  7.        user = User.objects.get(username=username)
  8.        user.set_password(novasenha)
  9.        user.save()
  10.        messages.success(request,'Senha alterada com sucesso!')
  11. else:
  12.        messages.success(request, 'Dados errados')
  13.        return render(request,'password_form.html')
  14.  
  15. return render(request,'password_form.html')
  16.      
  17. <div class="container">
  18.     <form method="POST">
  19.         {% csrf_token %}
  20.         <label>UsuĆ”rio</label>
  21.         <input type="text" name="username"><br>
  22.         <br>
  23.         <label>E-mail</label>
  24.         <input type="email" name="email"><br>
  25.         <br>
  26.         <label>Nova Senha</label>
  27.         <input type="password" name="novasenha"><br>
  28.         <br>
  29.     <button type="submit">SALVAR</button>
  30.     </form>
  31. </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top