def calendar_user_change_pw(request, object_id): """ CalendarUser Detail change **Attributes**: * ``form`` - CalendarUserPasswordChangeForm * ``template`` - 'appointment/calendar_user/change_password.html', 'frontend/registration/user_detail_change.html' **Logic Description**: * Reset calendar_user password. """ calendar_user_userdetail = get_object_or_404(CalendarUser, pk=object_id) calendar_user_username = calendar_user_userdetail.username user_password_form = CalendarUserPasswordChangeForm(calendar_user_userdetail, request.POST or None) if user_password_form.is_valid(): user_password_form.save() request.session["msg"] = _("%s password has been changed." % calendar_user_username) return HttpResponseRedirect(redirect_url_to_calendar_user_list) data = {"calendar_user_username": calendar_user_username, "user_password_form": user_password_form} request.session["msg"] = "" request.session["error_msg"] = "" return render_to_response( "appointment/calendar_user/change_password.html", data, context_instance=RequestContext(request) )
def calendar_user_change_password(request, object_id): """ CalendarUser Detail change **Attributes**: * ``form`` - CalendarUserPasswordChangeForm * ``template`` - 'appointment/calendar_user/change_password.html', 'frontend/registration/user_detail_change.html' **Logic Description**: * Reset calendar_user password. """ calendar_user_userdetail = get_object_or_404(CalendarUser, pk=object_id) calendar_user_username = calendar_user_userdetail.username user_password_form = CalendarUserPasswordChangeForm( calendar_user_userdetail, request.POST or None) if user_password_form.is_valid(): user_password_form.save() request.session["msg"] = _('%s password has been changed.' % calendar_user_username) return HttpResponseRedirect(redirect_url_to_calendar_user_list) data = { 'calendar_user_username': calendar_user_username, 'user_password_form': user_password_form, } request.session['msg'] = '' request.session['error_msg'] = '' return render_to_response('appointment/calendar_user/change_password.html', data, context_instance=RequestContext(request))
def calendar_user_change_password(request, object_id): """ CalendarUser Detail change **Attributes**: * ``form`` - CalendarUserPasswordChangeForm * ``template`` - 'frontend/appointment/calendar_user/change_password.html', 'frontend/registration/user_detail_change.html' **Logic Description**: * Reset calendar_user password. """ msg_pass = '' error_pass = '' calendar_user_userdetail = get_object_or_404(CalendarUser, pk=object_id) calendar_user_username = calendar_user_userdetail.username user_password_form = CalendarUserPasswordChangeForm(user=calendar_user_userdetail) if request.method == 'POST': user_password_form = CalendarUserPasswordChangeForm(user=calendar_user_userdetail, data=request.POST) if user_password_form.is_valid(): user_password_form.save() request.session["msg"] = _('%s password has been changed.' % calendar_user_username) return HttpResponseRedirect(redirect_url_to_calendar_user_list) else: error_pass = _('please correct the errors below.') template = 'frontend/appointment/calendar_user/change_password.html' data = { 'calendar_user_username': calendar_user_username, 'user_password_form': user_password_form, 'msg_pass': msg_pass, 'error_pass': error_pass, } request.session['msg'] = '' request.session['error_msg'] = '' return render_to_response(template, data, context_instance=RequestContext(request))