def validate(self, model, errors): r = self.request if not User.by_credentials(self.session, model.login, r.params['current_password']): errors.append(_(u'current password is not correct')) elif r.params['user.password'] == r.params['current_password']: errors.append(_(u'password is inchanged')) if r.params['user.password'] != r.params['confirm_password']: errors.append(_(u'passwords do not match')) return len(errors) == 0
def authbasic(request): """ Authentification basic, Upload pyshop repository access """ if len(request.environ.get('HTTP_AUTHORIZATION','')) > 0: auth = request.environ.get('HTTP_AUTHORIZATION') scheme, data = auth.split(None, 1) assert scheme.lower() == 'basic' username, password = data.decode('base64').split(':', 1) if User.by_credentials(DBSession(), username, password): return HTTPFound(location=request.url) return Response(status=401, headerlist=[('WWW-Authenticate', ('Basic realm="%s"' % _('pyshop repository access')).encode('utf-8') )], )
def validate(self, model, errors): r = self.request if r.params["user.password"] != r.params["confirm_password"]: errors.append(_("passwords do not match")) return len(errors) == 0
def validate(self, model, errors): r = self.request if r.params['user.password'] != r.params['confirm_password']: errors.append(_('passwords do not match')) return len(errors) == 0