def get(self): """Offers login form to user """ skip_fields=['date_joined', 'last_login'] form_fields = user_form(skip_fields=skip_fields) return self.render_template('accounts/login.html', form_fields=form_fields)
def get(self): """Offers login form to user """ skip_fields = ['date_joined', 'last_login'] form_fields = user_form(skip_fields=skip_fields) return self.render_template('accounts/login.html', form_fields=form_fields)
def register(request): registered = False users = userProfile.objects.all() counter = len(users) if request.method == 'POST': uform = user_form(request.POST) pform = user_profile_form(request.POST) if uform.is_valid() and pform.is_valid(): counter += 1 user = uform.save() user.set_password(user.password) #hashes the password user.save() profile = pform.save(commit=False) profile.user = user profile.userId = counter profile.joined = datetime.datetime.now() profile.username = user.get_username() profile.location = pform.cleaned_data.get('location') request.session['from_method'] = 'register' request.session['username'] = profile.username if 'picture' in request.FILES: profile.picture = request.FILES['picture'] profile.save() registered = True else: print uform.errors, pform.errors else: uform = user_form() pform = user_profile_form() return render(request, 'kerbie/register.html', {'user_form': uform, 'profile_form': pform, 'registered': registered})
def post(self): """Attempts to create an account with the credentials provided in the post arguments. Successful creation logs the user in and sends them to '/'. Failure returns the user to the account create screen and tells them what went wrong. """ username = self.get_argument("username") password = self.get_argument("password") try: u = User.create_user(username, password) u.validate() save_user(self.db_conn, u) except Exception, e: logging.error("Credentials failed") logging.error(e) form_fields = user_form(skip_fields=self.skip_fields, values={"username": username}) return self.render_template("accounts/create.html", form_fields=form_fields)
def post(self): """Attempts to create an account with the credentials provided in the post arguments. Successful creation logs the user in and sends them to '/'. Failure returns the user to the account create screen and tells them what went wrong. """ username = self.get_argument('username') password = self.get_argument('password') try: u = User.create_user(username, password) u.validate() save_user(self.db_conn, u) except Exception, e: logging.error('Credentials failed') logging.error(e) form_fields = user_form(skip_fields=self.skip_fields, values={'username': username}) return self.render_template('accounts/create.html', form_fields=form_fields)
def get(self): """Offers login form to user """ form_fields = user_form(skip_fields=self.skip_fields) return self.render_template('accounts/create.html', form_fields=form_fields)
def get(self): """Offers login form to user """ skip_fields = ["date_joined", "last_login"] form_fields = user_form(skip_fields=skip_fields) return self.render_template("accounts/login.html", form_fields=form_fields)
def get(self): """Offers login form to user """ form_fields = user_form(skip_fields=self.skip_fields) return self.render_template("accounts/create.html", form_fields=form_fields)