Skip to content

Instantly share code, notes, and snippets.

@Lh4cKg
Last active March 21, 2021 18:24
Show Gist options
  • Save Lh4cKg/3013e0838b57bd4d375809c75cd660c8 to your computer and use it in GitHub Desktop.
Save Lh4cKg/3013e0838b57bd4d375809c75cd660c8 to your computer and use it in GitHub Desktop.
Django Bootstrap Registration Form | Jqwidgets Style Registration Form, using jqwidgets
# _*_ coding: utf-8 _*_
"""
IPC
Created on Apr 24, 2017
@author: lasha gogua
"""
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from app.authuser.models import UserData, UserType
class RegistrationForm(forms.ModelForm):
user_name = forms.CharField(label=_('Username'),
error_messages={'required': _('Username is Required'),
'invalid': _('This value must contain only letters, numbers and underscores.')}, required=True,
widget=forms.TextInput(attrs={'class': 'form-control'}))
password = forms.CharField(label=_('Password'), widget=forms.PasswordInput(render_value=True, attrs={'class': 'form-control'}),
error_messages={'required': _('Password is Required'),
'invalid': _('This value must contain only letters, numbers and underscores.')})
confirm_password = forms.CharField(label=_('Confirm Password'), widget=forms.PasswordInput(render_value=True, attrs={'class': 'form-control'}),
error_messages={'required': _('Confirm Password is Required'),
'invalid': _('This value must contain only letters, numbers and underscores.')})
user_type = forms.ModelChoiceField(label=_('User Type'),
queryset=UserType.objects.exclude(name='შიდა მომხმარებელი').all(),
error_messages={'required': _('User Type is Required'),
'invalid': _('User Type Invalid Value, Please Choose User type')})
pin = forms.CharField(label=_('Personal ID'), required=True,
error_messages={'required': _('Personal ID is Required'),
'invalid': _('Enter Valid ID, This value must contain only numbers')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
name = forms.CharField(label=_('First Name'), required=True,
error_messages={'required': _('First Name is Required'),
'invalid': _('This value must contain only letters')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
name_eng = forms.CharField(label=_('First Name En'), required=False,
error_messages={'required': _('First Name is Required'),
'invalid': _('This value must contain only letters')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
last_name = forms.CharField(label=_('Last Name'), required=False,
error_messages={'required': _('Last Name is Required'),
'invalid': _('This value must contain only letters')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
last_name_eng = forms.CharField(label=_('Last Name En'), required=False,
error_messages={'required': _('Last Name is Required'),
'invalid': _('This value must contain only letters')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
phone = forms.CharField(label=_('Phone'), required=True,
error_messages={'required': _('Phone is Required'),
'invalid': _('This value must contain only numbers')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
mail = forms.CharField(label=_('Email'), required=True,
error_messages={'required': _('Email is Required'),
'invalid': _('This value must contain email type')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
registration_address = forms.CharField(label=_('Registration Address'), required=True,
error_messages={'required': _('Registration Address is Required'),
'invalid': _('This value must contain only letters')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
actual_address = forms.CharField(label=_('Actual Address'), required=True,
error_messages={'required': _('Actual Address is Required'),
'invalid': _('This value must contain only letters')},
widget=forms.TextInput(attrs={'class': 'form-control'}))
class Meta:
model = UserData
fields = ('user_name', 'user_type', 'pin', 'name', 'name_eng', 'last_name', 'last_name_eng', 'phone',
'mail', 'registration_address', 'actual_address',)
def clean_user_name(self):
username = self.cleaned_data.get('user_name')
try:
User.objects.get(username=username)
except User.DoesNotExist:
return username
raise forms.ValidationError(_('Username already exists, Please enter other username'))
def clean_pin(self):
pin = self.cleaned_data.get('pin')
if not isinstance(pin, int) and len(pin) < 11:
raise forms.ValidationError(_('Personal ID is Wrong, This value must contain only numbers'))
try:
UserData.objects.get(pin=pin)
except UserData.DoesNotExist:
return pin
raise forms.ValidationError(_('Personal ID Already exists!, Please enter valid Personal ID'))
def clean_mail(self):
email = self.cleaned_data.get('mail')
try:
UserData.objects.get(mail=email)
except UserData.DoesNotExist:
return email
raise forms.ValidationError(_('Email Already exists!, Please enter other Email'))
def clean(self):
if not self.cleaned_data.has_key('password') or not self.cleaned_data.has_key('confirm_password'):
raise forms.ValidationError(_('Password does not match.'))
if self.cleaned_data.get('password') != self.cleaned_data.get('confirm_password'):
raise forms.ValidationError(_('Password does not match the confirm password.'))
return self.cleaned_data
{% load staticfiles %}
{% load i18n %}
{% load djqwidget_tags %}
<!DOCTYPE html>
<html style="width:100%;height:100%;padding:0;margin:0;background-color:#f3f3f3;">
<head>
<meta charset="UTF-8">
<title>{% if project_title %} {{project_title}} {% else %} Innotec {% endif %}</title>
{% if company_favicon %}
<link rel="shortcut icon" href="{% static company_favicon %}">
{% else %}
<link rel="shortcut icon" href="{% static 'djqiwi/img/demo/favicon.ico' %}">
{% endif %}
<!-- jQWidgets Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.base.css'%}" type="text/css" />
<!-- jQWidgets Theme Styles -->
{% if djqiwi_style_csses %}
{%for css in djqiwi_style_csses %}
<link rel="stylesheet" href="{% static css %}" type="text/css" />
{% endfor %}
{% else %}
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.energyblue.css'%}" type="text/css" />
{% endif %}
{% if djqiwi_additional_csses %}
{%for css in djqiwi_additional_csses %}
<link rel="stylesheet" href="{% static css %}" type="text/css" />
{% endfor %}
{% endif %}
<!-- DJQiwi Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/css/flexbox.css'%}" type="text/css" >
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="{% static 'djqiwi/scripts/jquery-1.11.1.min.js' %}"></script>
<!-- <script type="text/javascript" src="{% static 'djqiwi/scripts/jquery-1.11.1.js' %}"></script> -->
<!-- JQWidgets -->
<!-- ALL -->
<script type="text/javascript" src="{% static 'djqiwi/jqwidgets/jqx-all.js' %}"></script>
<style type="text/css">
.footer
{
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
.jqx-window-modal
{
background-color:#E0E9F5 !important;
}
</style>
</head>
<body style="width:100%;height:100%;padding:0;margin:0;background-image:url({% static 'ipc/img/pattern.png' %});background-size:cover;">
<div style="margin-top:-7%;" id="window" caption="{% trans 'Log in' %}">
<div>
<form method="post" class="login-form">
{% csrf_token %}
<input type="hidden" name="next" value="{{success_redirect_url}}"/>
<table>
<tr>
<td style="text-align:center;" colspan="2">
<img src="{% static 'ipc/img/logo_old.png' %}" style="width:280px;margin-left:15px;">
</td>
</tr>
<tr>
<td style="padding:5px 5px 0 10px;" colspan="2">{% trans 'username' as username_label %}{{username_label|capfirst}}:</td>
</tr>
<tr>
<td style="padding:3px 5px 5px 10px;" colspan="2"><input id="user" style="width: 300px;" type="text" name="username" /></td>
</tr>
<tr>
<td style="padding:5px 5px 0 10px;" colspan="2">{% trans 'Password' %}:</td>
</tr>
<tr>
<td style="padding:3px 5px 5px 10px;" colspan="2"><input id="password" style="width: 300px;" type="password" name="password" /></td>
</tr>
<tr>
<td style="padding-top:5px;" align="center" colspan="2">
{% if form.errors %}
<span style="color:red;">{% for error in form.non_field_errors %}{{error}}{% endfor %}</span>
{% else %}
&nbsp;
{% endif %}
</td>
</tr>
<tr>
<td style="padding:6px 5px 0 10px;" align="center" colspan=2>
<!-- <div style="float:left; margin-top:4px;" id="remember_me" name="remember_me"></div> -->
<!-- <label style="float:left;margin-top:3px;">Remember me</label> -->
<input style="width:110px;margin-right:5px;" type="submit" id="submit" value="{% trans 'Log in' %}" />
</td>
</tr>
<tr>
<td colspan="1" style="width:100%">
<div id="registration" style="text-align: left; margin-top: 15px;"><a href="{% url 'registration' %}" style=" color: black">{% trans 'Registration' %}</a></div>
</td>
<td colspan="1" style="width:100%">
<div id="reset_password" style="text-align: right; margin-top: 15px"><a href="{% url 'password_reset' %}" style="color: black">{% trans 'Reset Password' %}</a></div>
</td>
</tr>
</table>
</form>
</div>
</div>
<div class="footer jqx-theme-border-color jqx-theme-background-color" style="position:absolute;left:0; right:0; bottom:0; height:21px;">
{% settings_value 'DJQIWI_BOTTOM_LINE_TEXT' 'Copyright &copy; Innotec LLC' %}
</div>
<script type="text/javascript">
var jqx_theme = '{{ djqiwi_default_style }}';
var STATIC_URL_BASE = '{% static "" %}'
$(document).ready(function () {
$('#window').jqxWindow({
theme: jqx_theme,
width: 335,
height: 250+192,
isModal: true,
showCloseButton: false,
keyboardCloseKey: 0,
draggable: false,
resizable: false,
});
$('#user').jqxInput({
theme:jqx_theme,
height:24,
})
$('#password').jqxInput({
theme:jqx_theme,
height:24,
})
/*
$('#remember_me').jqxCheckBox({
theme:jqx_theme,
})
*/
$('#submit').jqxButton({
theme: jqx_theme,
cursor:'pointer',
});
});
</script>
</body>
</html>
# _*_ coding: UTF-8 _*_
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import Group, User
from django.utils.translation import ugettext_lazy as _, pgettext_lazy as _c
from django.core.exceptions import ValidationError
import re
class UserType(models.Model):
"""
**Model for User Types**
"""
name = models.CharField(max_length=64)
def __str__(self):
return self.name
def __unicode__(self):
return self.name
class Meta:
db_table = "auth_user_types"
verbose_name = "User Type"
verbose_name_plural = "User Types"
class UserOrgUnit(models.Model):
"""
**Model for Organization Units**
In this recursive model organization units are described, such as departments, groups and etc.
Data attributes:
- parent - Id of parent unit. This field is not mandatory.
- code - Codename of unit. Mandatory field.
- name - Name of unit. Mandatory field.
"""
parent = models.ForeignKey("self", null=True, blank=True, related_name="department_parent")
code = models.CharField(max_length=64, unique=True)
name = models.CharField(max_length=512)
def __str__(self):
return self.name
def __unicode__(self):
return self.name
def clean(self):
if not (re.match(r'^[A-Z0-9_]+$', self.code) and not(re.match(r'^[_]*$', self.code))):
raise ValidationError(('Only upper case letters, numbers and underscores are allowed in Code field'))
class Meta:
db_table = "auth_org_units"
verbose_name = "Org Unit"
verbose_name_plural = "Org Units"
class UserData(models.Model):
"""
**Model for User Details**
This model is extension of django's User model.
Primary keys for django.contrib.auth.models object and corresponding UserData object are identical.
"""
user = models.OneToOneField(User, primary_key = True, db_column='id') #დათოს უნდა ვკითხოთ
user_type = models.ForeignKey(UserType)
user_name = models.CharField(max_length=512)
pin = models.CharField(max_length=11)
name = models.CharField(max_length=512)
name_eng = models.CharField(max_length=512, null=True, blank=True)
last_name = models.CharField(max_length=512, null=True, blank=True)
last_name_eng = models.CharField(max_length=512, null=True, blank=True)
phone = models.CharField(max_length=512, null=True, blank=True)
mobile = models.CharField(max_length=512, null=True, blank=True)
mail = models.CharField(max_length=512, null=True, blank=True)
registration_zip = models.CharField(max_length=8, null=True, blank=True)
registration_location = models.CharField(max_length=512, null=True, blank=True)
registration_location_eng = models.CharField(max_length=512, null=True, blank=True)
registration_address = models.CharField(max_length=512, null=True, blank=True)
registration_address_eng = models.CharField(max_length=512, null=True, blank=True)
actual_zip = models.CharField(max_length=8, null=True, blank=True)
actual_location = models.CharField(max_length=512, null=True, blank=True)
actual_location_eng = models.CharField(max_length=512, null=True, blank=True)
actual_address = models.CharField(max_length=512, null=True, blank=True)
actual_address_eng = models.CharField(max_length=512, null=True, blank=True)
groups = models.ManyToManyField(Group, blank=True)
org_unit = models.ForeignKey(UserOrgUnit)
identified = models.CharField(max_length=20, choices=(('YES', _('Yes')), ('NO', _('No'))), default='NO')
def __str__(self):
return u"%s %s" % (self.name, self.last_name)
def __unicode__(self):
return u"%s %s" % (self.name, self.last_name)
class Meta:
db_table = "auth_user_datum"
verbose_name = "User Data"
verbose_name_plural = "User Datum"
{% load staticfiles %}
{% load i18n %}
{% load djqwidget_tags %}
<!DOCTYPE html>
<html style="width:100%;height:100%;padding:0;margin:0;background-color:#f3f3f3;">
<head>
<meta charset="UTF-8">
<title>{% trans 'IPCG Sakpatenti' %}</title>
<link rel="shortcut icon" href="{% static 'ipc/img/favicon.ico' %}">
<!-- jQWidgets Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.base.css' %}" type="text/css"/>
<!-- jQWidgets Theme Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.energyblue.css' %}" type="text/css"/>
<link rel="stylesheet" href="{% static 'ip_object/styles/ipo_case.css' %}" type="text/css"/>
<!-- DJQiwi Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/css/flexbox.css' %}" type="text/css">
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="{% static 'djqiwi/scripts/jquery-1.11.1.min.js' %}"></script>
<!-- JQWidgets -->
<!-- ALL -->
<script type="text/javascript" src="{% static 'djqiwi/jqwidgets/jqx-all.js' %}"></script>
<style type="text/css">
.footer {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
#password_reset_window {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
.jqwidget-style-window-header {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
color: #333;
text-align: center;
line-height: 2;
font-weight: bold;
}
.jqx-window-modal {
background-color: #E0E9F5 !important;
}
td.form-label {
text-align: initial;
}
table.rftb {
margin: auto;
margin-top: 15px;
margin-bottom: 15px;
}
ul.errorlist {
color: red;
margin: auto;
list-style: none;
text-align: center;
{# margin-left: -35px;#}
}
.required:before {
content:"* ";
color: red;
}
.jqwidget-style-window-header {
display: block;
background: #a4bed4;
width: 700px;
height: 30px;
margin: auto;
margin-top: 15px;
border: solid #a4bed4 1px;
}
</style>
</head>
<body style="width:100%;height:100%;padding:0;margin:0;background-image:url({% static 'ipc/img/pattern.png' %});background-size:cover;">
<div class="jqwidget-style-window-header">
<span>{% trans 'Password Reset' %}</span>
</div>
<div id="password_reset_window" style="width: 700px;margin: auto; background: white; margin-bottom: 15px; border: solid #a4bed4 1px;border-radius: 0px 0px 4px 4px;" caption="{% trans 'Registration' %}">
<div>
<form method="post" class="password-reset-form"> {% csrf_token %}
<table class="rftb" style="width: 90%">
<tr style="width: 90%">
<td class="form-label required" colspan="1" style="width:15%;">{% trans 'Email' %}:</td>
<td class="form-label" colspan="1" style="width:90%;">
<input id="id_email" type="text" name="email"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.email.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
{# <td class="form-label" colspan="2" style="width:90%;"></td>#}
<td style="padding:6px 5px 0 10px; width: 90%;" align="center" colspan="2">
<input style="width:135px;margin-right:5px;" type="submit" id="submit" value="{% trans 'Reset' %}" />
</td>
</tr>
{# <tr style="width: 90%">#}
{# {% if form.errors %}{% for error in form.non_field_errors %}{{error}}{% endfor %}{% endif %}#}
{# </tr>#}
</table>
</form>
</div>
</div>
<div class="footer jqx-theme-border-color jqx-theme-background-color"
style="position:fixed;left:0; right:0; bottom:0; height:21px;">
{% settings_value 'DJQIWI_BOTTOM_LINE_TEXT' 'Copyright &copy; Innotec LLC' %}
</div>
<script type="text/javascript">
var STATIC_URL_BASE = '{% static "" %}';
$(document).ready(function () {
$('#id_email').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#submit').jqxInput({
theme: 'energyblue',
height: 24,
width: '100'
});
});
</script>
</body>
</html>
{% load staticfiles %}
{% load i18n %}
{% load djqwidget_tags %}
<!DOCTYPE html>
<html style="width:100%;height:100%;padding:0;margin:0;background-color:#f3f3f3;">
<head>
<meta charset="UTF-8">
<title>{% trans 'IPCG Sakpatenti' %}</title>
<link rel="shortcut icon" href="{% static 'ipc/img/favicon.ico' %}">
<link rel="stylesheet" href="{% static 'ip_object/styles/ipo_case.css' %}" type="text/css"/>
<style type="text/css">
.footer {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
#password_reset_done_window {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
.jqwidget-style-window-header {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
color: #333;
text-align: center;
line-height: 2;
font-weight: bold;
}
.jqwidget-style-window-header {
display: block;
background: #a4bed4;
width: 700px;
height: 30px;
margin: auto;
margin-top: 15px;
border: solid #a4bed4 1px;
}
</style>
</head>
<body style="width:100%;height:100%;padding:0;margin:0;background-image:url({% static 'ipc/img/pattern.png' %});background-size:cover;">
<div class="jqwidget-style-window-header">
<span>{% trans 'Password Reset' %}</span>
</div>
<div id="password_reset_done_window" style="width: 700px;margin: auto; background: white; margin-bottom: 15px; border: solid #a4bed4 1px;border-radius: 0px 0px 4px 4px;" caption="{% trans 'Password Reset' %}">
<div>
<table>
<tr style="width: 90%">
<td style="padding:6px 5px 0 10px;" align="left" colspan="1">
<div id="back" style="text-align: left; margin-top: 15px;">
<h1>{{ title }}</h1>
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p><a href="/app/home/">{% trans 'Log in' %}</a></p>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="footer jqx-theme-border-color jqx-theme-background-color"
style="position:fixed;left:0; right:0; bottom:0; height:21px;">
{% settings_value 'DJQIWI_BOTTOM_LINE_TEXT' 'Copyright &copy; Innotec LLC' %}
</div>
</body>
</html>
{% load staticfiles %}
{% load i18n %}
{% load djqwidget_tags %}
<!DOCTYPE html>
<html style="width:100%;height:100%;padding:0;margin:0;background-color:#f3f3f3;">
<head>
<meta charset="UTF-8">
<title>{% trans 'IPCG Sakpatenti' %}</title>
<link rel="shortcut icon" href="{% static 'ipc/img/favicon.ico' %}">
<!-- jQWidgets Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.base.css' %}" type="text/css"/>
<!-- jQWidgets Theme Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.energyblue.css' %}" type="text/css"/>
<link rel="stylesheet" href="{% static 'ip_object/styles/ipo_case.css' %}" type="text/css"/>
<!-- DJQiwi Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/css/flexbox.css' %}" type="text/css">
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="{% static 'djqiwi/scripts/jquery-1.11.1.min.js' %}"></script>
<!-- JQWidgets -->
<!-- ALL -->
<script type="text/javascript" src="{% static 'djqiwi/jqwidgets/jqx-all.js' %}"></script>
<style type="text/css">
.footer {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
#password_reset_window {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
.jqwidget-style-window-header {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
color: #333;
text-align: center;
line-height: 2;
font-weight: bold;
}
.jqx-window-modal {
background-color: #E0E9F5 !important;
}
td.form-label {
text-align: initial;
}
table.rftb {
margin: auto;
margin-top: 15px;
margin-bottom: 15px;
}
ul.errorlist {
color: red;
margin: auto;
list-style: none;
text-align: center;
{# margin-left: -35px;#}
}
.required:before {
content:"* ";
color: red;
}
.jqwidget-style-window-header {
display: block;
background: #a4bed4;
width: 700px;
height: 30px;
margin: auto;
margin-top: 15px;
border: solid #a4bed4 1px;
}
</style>
</head>
<body style="width:100%;height:100%;padding:0;margin:0;background-image:url({% static 'ipc/img/pattern.png' %});background-size:cover;">
<div class="jqwidget-style-window-header">
<span>{% trans 'Password Reset' %}</span>
</div>
<div id="password_reset_window" style="width: 700px;margin: auto; background: white; margin-bottom: 15px; border: solid #a4bed4 1px;border-radius: 0px 0px 4px 4px;" caption="{% trans 'Registration' %}">
<div>
{% if validlink %}
<form method="post" class="password-reset-form"> {% csrf_token %}
<table class="rftb" style="width: 90%">
<tr style="width: 90%">
<td class="form-label required" colspan="1" style="width:15%;">{% trans 'New Password' %}:</td>
<td class="form-label" colspan="1" style="width:90%;">
<input id="id_new_password1" type="password" name="new_password1"/>
</td>
<tr>
<td colspan="2">{% if form.errors %} {{form.new_password1.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1" style="width:15%;">{% trans 'New Password Confirm' %}:</td>
<td class="form-label" colspan="1" style="width:90%;">
<input id="id_new_password2" type="password" name="new_password2"/>
</td>
<tr>
<td colspan="2">{% if form.errors %} {{form.new_password2.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td style="width: 90%; padding:6px 5px 0 10px;" align="center" colspan="2">
<input style="width:135px;margin-right:5px;" type="submit" id="submit" value="{% trans 'OK' %}" />
</td>
</tr>
</table>
</form>
{% else %}
<table>
<tr style="width: 90%">
<td style="padding:6px 5px 0 10px;" align="left" colspan="1">
<div id="back" style="text-align: left; margin-top: 15px;">
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
</div>
</td>
</tr>
</table>
{% endif %}
</div>
</div>
<div class="footer jqx-theme-border-color jqx-theme-background-color"
style="position:fixed;left:0; right:0; bottom:0; height:21px;">
{% settings_value 'DJQIWI_BOTTOM_LINE_TEXT' 'Copyright &copy; Innotec LLC' %}
</div>
<script type="text/javascript">
var STATIC_URL_BASE = '{% static "" %}';
$(document).ready(function () {
$('#id_new_password1').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_new_password2').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#submit').jqxInput({
theme: 'energyblue',
height: 24,
width: '100'
});
});
</script>
</body>
</html>
{% load staticfiles %}
{% load i18n %}
{% load djqwidget_tags %}
<!DOCTYPE html>
<html style="width:100%;height:100%;padding:0;margin:0;background-color:#f3f3f3;">
<head>
<meta charset="UTF-8">
<title>{% trans 'IPCG Sakpatenti' %}</title>
<link rel="shortcut icon" href="{% static 'ipc/img/favicon.ico' %}">
<link rel="stylesheet" href="{% static 'ip_object/styles/ipo_case.css' %}" type="text/css"/>
<style type="text/css">
.footer {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
#password_reset_done_window {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
.jqwidget-style-window-header {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
color: #333;
text-align: center;
line-height: 2;
font-weight: bold;
}
.jqwidget-style-window-header {
display: block;
background: #a4bed4;
width: 700px;
height: 30px;
margin: auto;
margin-top: 15px;
border: solid #a4bed4 1px;
}
</style>
</head>
<body style="width:100%;height:100%;padding:0;margin:0;background-image:url({% static 'ipc/img/pattern.png' %});background-size:cover;">
<div class="jqwidget-style-window-header">
<span>{% trans 'Password Reset' %}</span>
</div>
<div id="password_reset_done_window" style="width: 700px;margin: auto; background: white; margin-bottom: 15px; border: solid #a4bed4 1px;border-radius: 0px 0px 4px 4px;" caption="{% trans 'Password Reset' %}">
<div>
<table>
<tr style="width: 90%">
<td style="padding:6px 5px 0 10px;" align="left" colspan="1">
<div id="back" style="text-align: left; margin-top: 15px;">
<h1>{{ title }}</h1>
<p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p>
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="footer jqx-theme-border-color jqx-theme-background-color"
style="position:fixed;left:0; right:0; bottom:0; height:21px;">
{% settings_value 'DJQIWI_BOTTOM_LINE_TEXT' 'Copyright &copy; Innotec LLC' %}
</div>
</body>
</html>
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="{% static 'ipc/css/custom.css' %}">
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h1 class="well">Registration Form</h1>
<div class="col-lg-12 well">
<div class="row">
<form action="" method="POST">{% csrf_token %}
{% if form.errors %} <p>{{ form.errors }}</p> {% endif %}
<div class="col-sm-12">
<div class="form-group {% if form.username.errors %} error {% endif %}">
<label for="username">Username</label>
{{ form.user_name }}
{% if form.errors %} <p>{{form.username.errors}}</p> {% endif %}
</div>
<div class="form-group {% if form.password.errors %} error {% endif %}">
<label for="password">Password</label>
{{ form.password }}
{% if form.errors %} <p>{{form.password.errors}}</p> {% endif %}
</div>
<div class="form-group {% if form.confirm_password.errors %} error {% endif %}">
<label for="confirm_password">Confirm Password</label>
{{ form.confirm_password }}
{% if form.errors %} <p>{{form.confirm_password.errors}}</p> {% endif %}
</div>
<div class="form-group {% if form.user_type.errors %} error {% endif %}">
<label for="user_type">User Type</label>
<select name="user_type" class="form-control">
<option value="">Please Choose</option>
{% for f in form.fields.user_type.queryset %}
<option value="{{f.pk}}">{{f.name}}</option>
{% endfor %}
</select>
{% if form.errors %} <p>{{form.user_type.errors}}</p> {% endif %}
</div>
<div class="row">
<div class="col-sm-6 form-group {% if form.name.errors %} error {% endif %}">
<label for="name">First Name</label>
{{ form.name }}
{% if form.errors %} <p>{{form.name.errors}}</p> {% endif %}
</div>
<div class="col-sm-6 form-group {% if form.last_name.errors %} error {% endif %}">
<label for="last_name">Last Name</label>
{{ form.last_name }}
{% if form.errors %} <p>{{form.last_name.errors}}</p> {% endif %}
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group {% if form.name_eng.errors %} error {% endif %}">
<label for="name_eng">First Name EN</label>
{{ form.name_eng }}
{% if form.errors %} <p>{{form.name_eng.errors}}</p> {% endif %}
</div>
<div class="col-sm-6 form-group {% if form.last_name_eng.errors %} error {% endif %}">
<label for="last_name_eng">Last Name EN</label>
{{ form.last_name_eng }}
{% if form.errors %} <p>{{form.last_name_eng.errors}}</p> {% endif %}
</div>
</div>
<div class="form-group {% if form.pin.errors %} error {% endif %}">
<label for="pin">Personal ID</label>
{{ form.pin }}
{% if form.errors %} <p>{{form.pin.errors}}</p> {% endif %}
</div>
<div class="form-group {% if form.phone.errors %} error {% endif %}">
<label for="phone">Phone Number</label>
{{ form.phone }}
{% if form.errors %} <p>{{form.phone.errors}}</p> {% endif %}
</div>
<div class="form-group {% if form.mail.errors %} error {% endif %}">
<label for="mail">Email Address</label>
{{ form.mail }}
{% if form.errors %} <p>{{form.mail.errors}}</p> {% endif %}
</div>
<div class="form-group {% if form.registration_address.errors %} error {% endif %}">
<label for="registration_address">Registration Address</label>
{{ form.registration_address }}
{% if form.errors %} <p>{{form.registration_address.errors}}</p> {% endif %}
</div>
<div class="form-group {% if form.actual_address.errors %} error {% endif %}">
<label for="actual_address">Actual Address</label>
{{ form.actual_address }}
{% if form.errors %} <p>{{form.actual_address.errors}}</p> {% endif %}
</div>
<input type="submit" class="btn btn-lg btn-info" value="Submit"/>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
{% load staticfiles %}
{% load i18n %}
{% load djqwidget_tags %}
<!DOCTYPE html>
<html style="width:100%;height:100%;padding:0;margin:0;background-color:#f3f3f3;">
<head>
<meta charset="UTF-8">
<title>{% trans 'IPCG Sakpatenti' %}</title>
<link rel="shortcut icon" href="{% static 'ipc/img/favicon.ico' %}">
<!-- jQWidgets Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.base.css' %}" type="text/css"/>
<!-- jQWidgets Theme Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/jqwidgets/styles/jqx.energyblue.css' %}" type="text/css"/>
<link rel="stylesheet" href="{% static 'ip_object/styles/ipo_case.css' %}" type="text/css"/>
<!-- DJQiwi Styles -->
<link rel="stylesheet" href="{% static 'djqiwi/css/flexbox.css' %}" type="text/css">
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="{% static 'djqiwi/scripts/jquery-1.11.1.min.js' %}"></script>
<!-- JQWidgets -->
<!-- ALL -->
<script type="text/javascript" src="{% static 'djqiwi/jqwidgets/jqx-all.js' %}"></script>
<style type="text/css">
.footer {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
#registration_window {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
text-align: center;
}
.jqwidget-style-window-header {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
color: #333;
text-align: center;
line-height: 2;
font-weight: bold;
}
.jqx-window-modal {
background-color: #E0E9F5 !important;
}
td.form-label {
text-align: initial;
}
table.rftb {
margin: auto;
margin-top: 15px;
margin-bottom: 15px;
}
ul.errorlist {
color: red;
margin: auto;
list-style: none;
text-align: center;
{# margin-left: -35px;#}
}
.required:before {
content:"* ";
color: red;
}
.jqwidget-style-window-header {
display: block;
background: #a4bed4;
width: 700px;
height: 30px;
margin: auto;
margin-top: 15px;
border: solid #a4bed4 1px;
}
/* applied to the alert */
.jqx-alert
{
position: absolute;
overflow: hidden;
z-index: 99999;
margin: 0;
padding: 0;
}
/*applied to the header */
.jqx-alert-header
{
outline: none;
border: 1px solid #afc4d6;;
overflow: hidden;
padding: 5px;
height: auto;
white-space: nowrap;
overflow: hidden;
background-color: #afc4d6;
}
/*applied to the content*/
.jqx-alert-content
{
outline: none;
overflow: auto;
text-align: left;
background-color: #fff;
padding: 5px;
border: 1px solid #afc4d6;
border-top: none;
}
</style>
</head>
<body style="width:100%;height:100%;padding:0;margin:0;background-image:url({% static 'ipc/img/pattern.png' %});background-size:cover;">
<div class="jqwidget-style-window-header">
<span>{% trans 'Registration' %}</span>
</div>
<div id="registration_window" style="width: 700px;margin: auto; background: white; margin-bottom: 15px; border: solid #a4bed4 1px;border-radius: 0px 0px 4px 4px;" caption="{% trans 'Registration' %}">
<div>
<form method="post" class="registration-form"> {% csrf_token %}
<table class="rftb" style="width: 90%">
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'User Type' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><div id="id_user_type" name="user_type"></div></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.user_type.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1" style="width:31%;">{% trans 'Username' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_user_name" type="text" name="user_name"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.user_name.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%;">
<td class="form-label required" colspan="1">{% trans 'Password' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_password" type="password" name="password"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.password.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'Confirm Password' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_confirm_password" type="password" name="confirm_password"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.confirm_password.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'First Name' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_name" type="text" name="name"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.name.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'Last Name' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_last_name" type="text" name="last_name"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.last_name.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label" colspan="1">{% trans 'First Name En' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_name_eng" type="text" name="name_eng"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.name_eng.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label" colspan="1">{% trans 'Last Name En' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_last_name_eng" type="text" name="last_name_eng"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.last_name_eng.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'Personal ID' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_pin" type="text" name="pin"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.pin.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'Phone' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_phone" type="text" name="phone"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.phone.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'Email' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_mail" type="text" name="mail"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.mail.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'Registration Address' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_registration_address" type="text" name="registration_address"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.registration_address.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td class="form-label required" colspan="1">{% trans 'Actual Address' %}:</td>
<td class="form-label" colspan="1" style="width:90%;"><input id="id_actual_address" type="text" name="actual_address"/></td>
<tr>
<td colspan="2">{% if form.errors %} {{form.actual_address.errors}} {% endif %}</td>
</tr>
</tr>
<tr style="width: 90%">
<td style="padding:6px 5px 0 10px;" align="left" colspan="1">
<div id="back" style="text-align: left; margin-top: 15px;"><a href="/app/home" style=" color: black">< {% trans 'Back' %}</a></div>
</td>
<td style="padding:6px 5px 0 10px;" align="center" colspan="1">
<input style="width:135px;margin-right:5px;" type="submit" id="submit" value="{% trans 'OK' %}" />
</td>
</tr>
{# <tr style="width: 90%">#}
{# {% if form.errors %}{% for error in form.non_field_errors %}{{error}}{% endfor %}{% endif %}#}
{# </tr>#}
</table>
</form>
</div>
</div>
<div class="footer jqx-theme-border-color jqx-theme-background-color"
style="position:inherit;left:0; right:0; bottom:0; height:21px;">
{% settings_value 'DJQIWI_BOTTOM_LINE_TEXT' 'Copyright &copy; Innotec LLC' %}
</div>
<script type="text/javascript">
var STATIC_URL_BASE = '{% static "" %}';
var source = [];
{% for ut in form.fields.user_type.queryset %}
source.push({name: '{{ ut.name }}', value: '{{ ut.pk }}'});
{% endfor %}
$(document).ready(function () {
jqxAlert = {
// top offset.
top: 0,
// left offset.
left: 0,
// opacity of the overlay element.
overlayOpacity: 0.2,
// background of the overlay element.
overlayColor: '#ddd',
// display alert.
alert: function (message, title) {
if (title == null) title = 'Alert';
jqxAlert._show(title, message);
},
// initializes a new alert and displays it.
_show: function (title, msg) {
jqxAlert._hide();
jqxAlert._handleOverlay('show');
$("BODY").append(
'<div class="jqx-alert" style="width: 18%; height: auto; overflow: hidden; white-space: nowrap;" id="alert_container">' +
'<div id="alert_title"></div>' +
'<div id="alert_content">' +
'<div id="message"></div>' +
'<div class="button-holder" style="text-align:center;">'+
'<input style="margin-top: 10px;background-color: #afc4d6; border: 1px solid #afc4d6;" type="button" value="{% trans 'OK' %}" id="alert_button"/>' +
'</div>'+
'</div>' +
'</div>');
$("#alert_title").text(title);
$("#alert_title").addClass('jqx-alert-header');
$("#alert_content").addClass('jqx-alert-content');
$("#message").text(msg);
$("#alert_button").width(70);
$("#alert_button").click(function () {
jqxAlert._hide();
});
jqxAlert._setPosition();
},
// hide alert.
_hide: function () {
$("#alert_container").remove();
jqxAlert._handleOverlay('hide');
},
// initialize the overlay element.
_handleOverlay: function (status) {
switch (status) {
case 'show':
jqxAlert._handleOverlay('hide');
$("BODY").append('<div id="alert_overlay"></div>');
$("#alert_overlay").css({
position: 'absolute',
zIndex: 99998,
top: '0px',
left: '0px',
width: '100%',
height: $(document).height(),
background: jqxAlert.overlayColor,
opacity: jqxAlert.overlayOpacity
});
break;
case 'hide':
$("#alert_overlay").remove();
break;
}
},
// sets the alert's position.
_setPosition: function () {
// center screen with offset.
var top = (($(window).height() / 2) - ($("#alert_container").outerHeight() / 2)) + jqxAlert.top;
var left = (($(window).width() / 2) - ($("#alert_container").outerWidth() / 2)) + jqxAlert.left;
if (top < 0) {
top = 0;
}
if (left < 0) {
left = 0;
}
// set position.
$("#alert_container").css({
top: top + 'px',
left: left + 'px'
});
// update overlay.
$("#alert_overlay").height($(document).height());
}
};
{# $('#registration_window').jqxWindow({#}
{# theme: 'energyblue',#}
{# width: 700,#}
{# height: 'auto',#}
{# isModal: true,#}
{# showCloseButton: false,#}
{# keyboardCloseKey: 0,#}
{# draggable: false,#}
{# resizable: false#}
{# });#}
var userName = $('#id_user_name');
userName.jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_password').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_confirm_password').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
var userType = $('#id_user_type');
userType.jqxDropDownList({
theme: 'energyblue',
source: source,
width: '100%',
displayMember: 'name',
valueMember: 'value'
});
$('#id_name').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
var lastName = $('#id_last_name');
lastName.jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_name_eng').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
var lastNameEng = $('#id_last_name_eng');
lastNameEng.jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_pin').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_phone').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_mail').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_registration_address').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#id_actual_address').jqxInput({
theme: 'energyblue',
height: 24,
width: '100%'
});
$('#submit').jqxButton({
theme: 'energyblue',
cursor:'pointer'
});
lastName.parent().parent().hide();
lastNameEng.parent().parent().hide();
userType.on('change', function (e) {
if (userType.text() === 'იურიდიული პირი') {
$('#id_last_name').parent().parent().hide();
$('#id_last_name_eng').parent().parent().hide();
}
else {
$('#id_last_name').parent().parent().show();
$('#id_last_name_eng').parent().parent().show();
}
});
userName.on('keyup', function() {
var reg = /^[a-z0-9]+$/i;
if (!reg.test(userName.val()) && userName.val() != '') {
userName.val('');
jqxAlert.alert('{% trans "Please enter only latin letters" %}', '{% trans 'Message' %}');
}
});
});
</script>
</body>
</html>
# _*_ coding: utf-8 _*_
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^registration/$', views.registration, name='registration'),
url(r'^password_reset/$', views.ipc_password_reset, name='password_reset'),
url(r'^password_reset/done/$', views.ipc_password_reset_done, name='password_reset_done'),
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
views.ipc_password_reset_confirm, name='password_reset_confirm'),
url(r'^reset/done/$', views.ipc_password_reset_complete, name='password_reset_complete'),
]
# _*_ coding: utf-8 _*_
"""
IPC
Created on Apr 24, 2017
@author: lasha gogua
"""
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User, Group
from django.contrib.auth.views import password_reset, password_reset_confirm, password_reset_done, \
password_reset_complete
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.context_processors import csrf
from app.authuser.forms import RegistrationForm
from app.authuser.models import UserData, UserOrgUnit
def registration(request):
context = RequestContext(request)
if request.user.is_authenticated():
return HttpResponseRedirect('/app/home/')
if request.method == 'POST':
form = RegistrationForm(request.POST or None)
if form.is_valid():
user = User.objects.create_user(username=form.cleaned_data.get('user_name'),
email=form.cleaned_data.get('mail'),
password=form.cleaned_data.get('password'))
user.is_active = True
user.save()
# @INFO თუ მომხმარებელი რეგისტრირდება რაც ნიშნავს რომ არის გარემომხმარებელი
# @INFO ამიტომ მივანიჭოთ შესამაბის გრუპას "გარე მომხმარებლები"
group = Group.objects.filter(name='გარე მომხმარებლები').first()
if group:
user.groups.add(group)
user_data = UserData(user=user, user_name=form.cleaned_data.get('user_name'), name=form.cleaned_data.get('name'), name_eng=form.cleaned_data.get('name_eng'),
last_name=form.cleaned_data.get('last_name'), last_name_eng=form.cleaned_data.get('last_name_eng'),
pin=form.cleaned_data.get('pin'), mail=form.cleaned_data.get('mail'), user_type=form.cleaned_data.get('user_type'),
phone=form.cleaned_data.get('phone'), registration_address=form.cleaned_data.get('registration_address'),
actual_address=form.cleaned_data.get('actual_address'))
user_data.org_unit = UserOrgUnit.objects.filter(code=100).first()
user_data.save()
new_user = authenticate(username=form.cleaned_data.get('user_name'), password=form.cleaned_data.get('password'))
login(request, new_user)
return HttpResponseRedirect('/app/home/')
else:
print form.errors
else:
form = RegistrationForm()
c = {}
c['form'] = form
c.update(csrf(request))
return render_to_response('authuser/registration.html', c, context)
def ipc_password_reset(request, template_name='authuser/password_reset.html'):
if request.user.is_authenticated():
return HttpResponseRedirect('/app/home/')
return password_reset(request, template_name)
def ipc_password_reset_confirm(request, uidb64=None, token=None, template_name='authuser/password_reset_confirm.html'):
if request.user.is_authenticated():
return HttpResponseRedirect('/app/home/')
return password_reset_confirm(request, uidb64, token, template_name)
def ipc_password_reset_done(request, template_name='authuser/password_reset_done.html'):
if request.user.is_authenticated():
return HttpResponseRedirect('/app/home/')
return password_reset_done(request, template_name)
def ipc_password_reset_complete(request, template_name='authuser/password_reset_complete.html'):
if request.user.is_authenticated():
return HttpResponseRedirect('/app/home/')
return password_reset_complete(request, template_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment